برای استفاده از jQuery Ajax یکی از روشهای ارسال دیتا به برنامه، تبدیل دادهها به فرمت JSON میباشد. برای دادههای ساده، تشخیص این فرمت ساده است. مثلا اگر امضای تابع وب سرویس اجکس ما به صورت زیر باشد:
public static bool IsUserAvailable(string username)
{'username':'value'}
برای این منظور در دات نت 3 و نیم، کلاسی جهت انجام اینگونه تبدیلات پیش بینی شده است که شرح مختصر آن به صورت زیر است:
ابتدا باید ارجاعی را به اسمبلی system.web.extensions به برنامه افزود و سپس جهت سهولت کار میتوان یک extension method از کلاس JavaScriptSerializer مهیا در فضای نام System.Web.Script.Serialization ایجاد کرد:
public static string ToJson(this object data)
{
return new JavaScriptSerializer().Serialize(data);
}
public static string GetJsonTest0()
{
var data = "a1";
return data.ToJson();
}
public static string GetJsonTest1()
{
var data = new List<string> { "a1", "a2", "a3" };
return data.ToJson();
}
public static string GetJsonTest2()
{
var lst =
new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>("Name", "علی"),
new KeyValuePair<string, object>("Number", 10),
new KeyValuePair<string, object>("Desc", "منابع مورد نیاز")
};
return lst.ToJson();
}
"a1"
["a1","a2","a3"]
[{"Key":"Name","Value":"علی"},{"Key":"Number","Value":10},{"Key":"Desc","Value":"منابع مورد نیاز"}]
این کلاس همچنین قابلیت Deserialize و تبدیل دادههایی به فرمت JSON به اشیاء مورد نظر ما را نیز دارا است.
لیستی از APIهای جدید NET Core 3.0.
معرفی NET Standard.
With .NET Standard 2.0, we’re focusing on compatibility. In order to support .NET Standard 2.0 in .NET Core and UWP, we’ll be extending these platforms to include many more of the existing APIs. This also includes a compatibility shim that allows referencing binaries that were compiled against the .NET Framework.
NET Core 3.1 Preview 1. منتشر شد
Today, we’re announcing .NET Core 3.1 Preview 1. .NET Core 3.1 will be a small release focused on key improvements in Blazor and Windows desktop, the two big additions in .NET Core 3.0. It will be a long term support (LTS) release with an expected final ship date of December 2019.
- Testing with a mocking framework - EF6 onwards
+ شخصا اعتقادی به Unit tests درون حافظهای، در مورد لایه دسترسی به دادهها ندارم. به قسمت «Limitations of EF in-memory test doubles» مراجعه کنید؛ توضیحات خوبی را ارائه دادهاست.
تست درون حافظهی LINQ to Objects با تست واقعی LINQ to Entities که روی یک بانک اطلاعاتی واقعی اجرا میشود، الزاما نتایج یکسانی نخواهد داشت (به دلیل انواع قیود بانک اطلاعاتی، پشتیبانی از SQL خاص تولید شده تا بارگذاری اشیاء مرتبط و غیره) و نتایج مثبت آن به معنای درست کار کردن برنامه در دنیای واقعی نخواهد بود. در اینجا Integration tests بهتر جواب میدهند و نه Unit tests.
سری آموزشی Bash Scripting در لینوکس
Bash Scripting on Linux
The Bash Scripting Essentials series will teach you everything you need to know in order to write effective bash scripts in Linux. The series starts with some introductory concepts, with each episode building on the last. By the end of this series, you'll be able to write your own bash scripts! The Bash Scripting series was one of the very first tutorial series on Learn Linux TV ever, so it's basically where it all started. Now, it's been remade and brought into the modern age. The new version of this series covers everything the original version did, with additional concepts added throughout.
- آموزش MVC - قسمت هشتم - نمایش Autocomplete DropDownList در MVC | www.30sharp.com
- دانلود رایگان کتاب ۳۷۰ص وبلاگ نویسی شیرین با وردپرس | کسب و کار اینترنتی | www.ebusinessfa.com
- مقدمه ای بر RavenDB – قسمت اول | www.dotnetdev.info
- مقدمه ای بر RavenDB – قسمت دوم | www.dotnetdev.info
- Droid Arabic Kufi & Naskh for Google™ | 29letters.wordpress.com
- Microsoft Download Manager | www.microsoft.com
- Modern C++(0x) Programming with Visual Studio | www.microsoft.com
- System.Net.WebSockets در دات نت 4.5 | www.paulbatum.com
- Updated Release: Windows Phone Toolkit | silverlight.codeplex.com
- WebSockets در ویندوز 8 | www.paulbatum.com
- ابزارهای مدیریت پروژه رایگان | 3.7designs.co
- ایجاد چارت در ASP.NET MVC3 | mojtabasahraei.blogfa.com
- پایان توسعه Flash Player جهت دستگاههای موبایل | blogs.adobe.com
- پیاده سازی یک بافر حلقوی Generic در دات نت | www.blackwasp.co.uk
- زبان معاصر فارسی از دیدگاه یک غیرایرانی | 29letters.wordpress.com