نظرات مطالب
کار با کلیدهای اصلی و خارجی در EF Code first
من 3تا جدول زیر رو در بانک ساختم :

و کلاسها به صورت زیر تعریف کردم:
 public class Tb1 
    {
        public Tb1()
        {
            ListTb2 = new List<Tb2>();
        }
        public int Id { get; set; }
        public string NameTb1 { get; set; }

        public virtual ICollection<Tb2> ListTb2 { get; set; }
    }
    public class Tb2 
    {
        public Tb2()
        {
            ListTb1 = new List<Tb1>();
        }
        public int Id { get; set; }
        public string NameTb2 { get; set; }

        public virtual ICollection<Tb1> ListTb1 { get; set; }
    }
و همینطور mapping :
    public class Tb1Map : EntityTypeConfiguration<Tb1>
    {
        public Tb1Map()
        {
            this.HasKey(x => x.Id);

            this.HasMany(x => x.ListTb2)
                .WithMany(xx => xx.ListTb1)
                .Map
                (
                    x =>
                        {
                            x.MapLeftKey("Tb1Id");
                            x.MapRightKey("Tb2Id");
                            x.ToTable("Tb1Tb2");
                        }
                );

        }
    }

    public class Tb2Map : EntityTypeConfiguration<Tb2>
    {
        public Tb2Map()
        {
            this.HasKey(x => x.Id);
        }
    }
موقعی که در برنامه به صورت زیر استفاده می‌کنم:
            var sv1 = new TableService<Tb1>(_uow);
            var sv2 = new TableService<Tb2>(_uow);

            var t1 = new Tb1 { NameTb1 = "T111" };
            sv1.Add(t1);
            //var res1= _uow.SaveChanges();
            
            var t2 = new Tb2 { NameTb2 = "T222" };
            sv2.Add(t2);
            //var res2 = _uow.SaveChanges();

            t1.ListTb2.Add(t2);
            var result = _uow.SaveChanges();
 هنگام SaveChanges این خطا رو می‌ده: 
An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details.
همراه با innerException زیر:
{"The INSERT statement conflicted with the FOREIGN KEY constraint \"FK_Tb1Tb2_Tb2\". The conflict occurred in database \"dbTest\", table \"dbo.Tb2\", column 'Id'.\r\nThe statement has been terminated."}
در واقع همینطور که مشخصه من می‌خوام اون جدول رابطه رو در codeFirst حذف کنم یجورایی و رابطه رو بین 2 جدول اصلی بیارم. کجای کارم اشتباهه؟ و راهکارش چیه؟
من با پروفایلر هم نگاه کردم همه چی تا آخر داره پیش می‌ره!
(آیا ForeignKey رو باید طور دیگه ای تعریف کنم؟) 
با تشکر
اشتراک‌ها
حداقل‌ نیازهای مدیریت یک پروژه‌ی بزرگ

Basic Things

After working on the initial stages of several largish projects, I accumulated a list of things that share the following three properties:

  • they are irrelevant while the project is small,
  • they are a productivity multiplier when the project is large,
  • they are much harder to introduce down the line.

حداقل‌ نیازهای مدیریت یک پروژه‌ی بزرگ
اشتراک‌ها
استفاده از FontAwesome در WPF

Font Awesome gives you scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS. 

استفاده از FontAwesome در WPF
اشتراک‌ها
نگاهی به asynchronous در ES7

ES7 gives us a new kind of function, the async function. Inside of an async function, we have a new keyword, await, which we use to "wait for" a promise 

نگاهی به asynchronous در ES7
اشتراک‌ها
ترکیب HttpPost و ValidateAntiForgeryToken

I’ve been kicking around the idea of combining [HttpPost] and [ValidateAntiForgeryToken] in an application using authentication cookies. Both attributes typically appear together to prevent cross-site request forgeries in MVC applications using cookie based authentication. The result looks like the following.  

ترکیب HttpPost و  ValidateAntiForgeryToken
اشتراک‌ها
چه تفاوتی بین Update و Upgrade است؟

Update and upgrade are two different ways to make a change to an app or operating system. But the prime difference lies in a number of modifications made and the importance of those modifications. A software update includes bug fixes, and other small improvements, while a software upgrade changes the version of a software

چه تفاوتی بین Update و Upgrade است؟
اشتراک‌ها
Visual Studio Code 1.34 منتشر شد

Welcome to the April 2019 release of Visual Studio Code. During April, we were busy with the Preview release of the Remote Development extensions. These extensions let you work with VS Code over SSH on a remote machine or VM, in Windows Subsystem for Linux (WSL), or inside a Docker container. 

Visual Studio Code 1.34 منتشر شد
اشتراک‌ها
ASP.NET Core 2.2.0-preview1 منتشر شد

What’s new in 2.2

We’re publishing a series of posts here that go over some of the new feature areas in detail. We’ll update the post with links to these posts as they go live over the coming days:

  • API Controller Conventions
  • Endpoint Routing
  • Health Checks
  • HTTP/2 in Kestrel
  • Improvements to IIS hosting
  • SignalR Java client 
ASP.NET Core 2.2.0-preview1 منتشر شد
اشتراک‌ها
اجرای NET Core. بر روی معماری ARM

TL;DR: Nightly builds of the .NET Core Runtime for Ubuntu 16.04 on ARM are available here. These are "Hello World" tested on my Raspberry Pi 2 and Chromebook. Nightly builds of the SDK are expected in the next week or so. 

اجرای NET Core. بر روی معماری ARM