اشتراک‌ها
توسعه مستمر (Continuous deployment)
These days everybody wants to try new ideas as quickly as possible in the market. We want to see whether or not our customers like a new feature. If yes then we want to work on the feature and improve it and if not then we want to fail fast and learn fast from the mistake and correct fast
توسعه مستمر (Continuous deployment)
اشتراک‌ها
WPF و IOC در NET Core 3.0.

At work, we are planning to migrate our WPF application from .NET Framework 4.7 to .NET Core 3.0. The main reason for doing so is that it was always a big pain to organize the updates of the .NET Framework on our customer machines. So being able to bundle .NET Core with our application is a big plus for us. Then, for sure, we are looking for the performance improvements brought by .NET Core and finally the new capabilities brought by the fast pace of innovation of .NET Core. 

WPF و IOC در NET Core 3.0.
مطالب
WF:Windows Workflow #۶
در این قسمت به تکمیل مثالی که در قسمت قبل زده شد پرداخته می‌شود و همچنین کنترل‌های Foreach , Try Catch نیز بررسی خواهند شد.
در ابتدا دو کلاس به نام‌های ItemInfo و OutOfStockException  را به برنامه اضافه می‌کنیم. کلاس اول برای ذخیره سازی مشخصات هر سفارش و کلاس دیگر برای مدیریت خطا‌ها می‌باشد.
public class ItemInfo
    {
        public string ItemCode { get; set; } 
        public string Description { get; set; } 
        public decimal Price { get; set; }
    }

public class OutOfStockException : Exception
    {
        public OutOfStockException() 
            : base() 
        { 

        }

        public OutOfStockException(string message) 
            : base(message) 
        { 

        }
    }
در Workflow مورد نظر که به نام OrderWF.xaml می‌باشد٬ پس از کنترل Assign که برای صفر کردن مقدار متغیر TotalAmount از آن استفاده می‌شود٬ یک کنترل ForEach را به Flow جاری اضافه می‌کنیم. این کنترل دارای دو خاصیت به نام‌های Type Arguments و Values می‌باشد. اولین خاصیت که مقدار پیش فرض آن، مقدار عددی Int32 است٬ برای مشخص کردن نوع متغییر حلقه و دیگری برای مشخص کردن نوع منبع داده حلقه تعریف شده‌اند.

همانطور که در شکل بالا مشخص می‌باشد٬ Type Arguments حلقه برابر با کلاس OrderItem می‌باشد. Values هم برابر با OrderInfo.Items است. از این جهت نوع حلقه  را از جنس کلاس OrderItem مشخص کرد‌‌ه‌ایم تا کنترل بر روی مقادیر Items اجرا شود (لیستی از کلاس مورد نظر).
حال همانند شکل بالا، در قسمت Body کنترل ForEach، یک کنترل Sequence را ایجاد کرده و سپس برای اینکه کنترل LookupItem را ایجاد کنیم٬ ابتدا باید یک Code Activity را به پروژه اضافه کنیم. به همین منظور پروژه جاری را انتخاب کرده و یک Code Activity به آن اضافه و نام آن را LookupItem  می‌گذاریم. سپس کد زیر را به آن اضافه می‌کنیم:
 public sealed class LookupItem : CodeActivity
    {
        // Define an activity input argument of type string
        public InArgument<string> ItemCode { get; set; }         
        public OutArgument<ItemInfo> Item { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            ItemInfo i = new ItemInfo();             
            i.ItemCode = context.GetValue<string>(ItemCode);
            switch (i.ItemCode)
            {

                case "12345": 
                    i.Description = "Widget"; 
                    i.Price = (decimal)10.0; 
                    break;
                case "12346": 
                    i.Description = "Gadget"; 
                    i.Price = (decimal)15.0; 
                    break;
                case "12347": 
                    i.Description = "Super Gadget"; 
                    i.Price = (decimal)25.0; break;
            }
     
            context.SetValue(this.Item, i);
            
        }
    }
در این کد، دو متغییر تعریف شده‌اند؛ یکی از نوع رشته بوده و از طریق آن، دستور Switch تصمیم می‌گیرد که کلاس ItemInfo را با چه مقادیری پرکند. متغییر دیگر از نوع کلاس  ItemInfo می‌باشد و برای گرفتن مقدار کلاس از دستور Switch تعریف شده است.
حال برای اینکه بتوانیم از Code Activity مورد نظر استفاده کنیم٬ ابتدا باید پروژه را یکبار Build کنیم. اکنون در قسمت Toolbox یک٬ Tab ایی به نام پروژه ایجاد شده است و در آن یک کنترل به نام  LookupItem  موجود می‌باشد. آن را گرفته و به درون Sequence انتقال می‌دهیم.
سپس برای مقدار دادن به متغیر‌های تعریف شده در Code Activity، کنترل LookupItem را انتخاب کرده و در قسمت Properties به خصوصیت ItemCode، کد زیر را اضافه می‌کنیم:
item.ItemCode

نکته
: از کلاس Code Activity برای ارسال و دریافت مقادیر به درون Workflow استفاده می‌شود.

 Try Catch 
از این کنترل برای مدیریت خطا‌ها استفاده می‌شود.
ابتدا یک کنترل Try Catch را به Workflow اضافه کرده، مانند شکل زیر:

در بدنه Try می‌توان از کنترل‌های مورد نظر استفاده کنیم و همانطور که در شکل بالا مشخص است٬ از کنترل Throw برای ایجاد خطا استفاده شده‌است. کنترل جاری را انتخاب کرده و از قسمت Properties در خاصیت Exception کد زیر را اضافه می‌کنیم:
new OutOfStockException("Item Code"+item.ItemCode)
این  دستور باعث ایجاد یک خطا از نوع کلاس OutOfStockException می‌شود. برای کنترل خطای مورد نظر در قسمت Catches مانند شکل زیر عمل می‌کنیم.

اشتراک‌ها
آیا Rust بهترین زبان برنامه نویسی است؟

Rust – the Ultimate Programming Language?

What makes a good programming language? Syntax? Compiler? Tools and ecosystem? It is tempting to say “all of that” but in that case, why there are so many different programming languages? All these components are very important but they alone can’t make the language “good”. One of essential things is the purpose — like languages for rapid development, or development of distributed algorithms, or general purpose for high-level and low-level applications, or easy to learn, or safe to use and so on.

آیا Rust بهترین زبان برنامه نویسی است؟
اشتراک‌ها
Rider 2022.1 منتشر شد

Rider 2022.1 includes full Unreal Engine support, which converts Rider into a full-fledged IDE for game development, no matter what game engine you use. 

In v2022.1, Rider also supports a Beta version of the long-awaited remote development workflow. It allows you to connect to a remote machine running Rider’s backend from anywhere in the world.

In addition to these new features, this release also brings Docker Fast mode, updates to the main toolbar, and full-text search throughout the solution right from the Search Everywhere pop-up.

 
Rider 2022.1 منتشر شد
اشتراک‌ها
بررسی روش ساخت برنامه‌های چندمستاجری در ASP.NET Core

Jon P. Smith, author of Entity Framework Core in Action, explains what a multi-tenant app is and then digs into the things you need to do to make a multi-tenant app using ASP.NET Core with EF Core.

00:00 Countdown
02:19 Introduction and Community Links
18:25 What are multi-tenant web applications?
21:14 Single level multi-tenant demo
29:00 Partitioning tenants with EF Core QueryFilter
38:00 Admin features: creating users and tenants
43:00 Q&A
43:00 Hierarchical multi-tenant
59:00 How to get started
1:06:30 Database sharding and connection string management
1:16:30 Scaling with Azure SQL Elastic Pools
1:19:00 Conclusion
 

بررسی روش ساخت برنامه‌های چندمستاجری در ASP.NET Core
اشتراک‌ها
orchard core دیگر یک وب سایت مدیریت محتوا نیست !

orchard core دیگر یک وب سایت مدیریت محتوا نیست !

در نسخه Core این پروژه ( که به صورت کامل باز طراحی و بازنویسی شده ) تبدیل به یک سایت ساز شده است .

It is a completely new thing written in ASP.NET Core. The Orchard CMS was designed as a CMS, but Orchard Core was designed to be an<<  application framework >> that can be used to build a CMS, a blog or whatever you want to build 

orchard core دیگر یک وب سایت مدیریت محتوا نیست !
نظرات مطالب
C# 6 - String Interpolation
یک نکته‌ی تکمیلی: امکان تعریف عبارات string interpolation چند سطری در C# 11

در C# 11، متن درون {} یک عبارت string interpolation، می‌تواند در طی چند سطر نیز تعریف شود و متن بین {} به صورت یک عبارت #C تفسیر می‌شود. در اینجا هر عبارت معتبر #C ای را می‌توان بکار برد. در این حالت تعریف عبارات LINQ و pattern matching switch expressions ساده‌تر می‌شوند. برای مثال:
namespace CS11Tests;

public static class NewLinesStringInterpolations
{
    public static void Test()
    {
        var month = 8;
        var season = $"The season is {month switch
        {
            >= 1 and <= 3 => "spring",
            >= 4 and <= 6 => "summer",
            >= 7 and <= 9 => "autumn",
            10 or 11 or 12 => "winter",
            _ => "Wrong month number",
        }}.";
        Console.WriteLine(season);

        int[] numbers = { 1, 2, 3, 4, 5, 6 };
        var message = $"The reversed even values of {nameof(numbers)} are {string.Join(", ",
            numbers.Where(n => n % 2 == 0).Reverse())}.";
        Console.WriteLine(message);
    }
}
اشتراک‌ها
چرا برنامه نویسان باید زبان Golang را یاد بگیرند

Go, also referred to as Golang is a program created by Google. It was designed by Ken Thompson, Rob Pike, and Robert Griesmer. Golang is one of the most rapidly growing languages in terms of popularity. Ken Thompson, Rob Pike, and Robert Griesmer created Go Language to be a language that has numerous cores, implements concurrency easily, works smoothly in a distributed environment and allows the programmer to write programs without too much hustle. Go language also has a lean and user-friendly syntax. 

چرا برنامه نویسان باید زبان Golang را یاد بگیرند