Pros and cons of Database identity
Nice to work with in URLs
Limiting, as they require a trip to the database, which precludes some patterns
Can be tricky to return IDs when inserting in some cases (EF Core etc solves this)
Can cause contention in high throughput scenarios. May make scaling out impossible
اشتراکها
- Functional Defects
- Problems with the logic
- Missing Validation (e.g., edge cases)
- Usage of API
- Design Patterns
- Architectural Issues
- Testability
- Readability
- Security
- Naming conventions
- Team Coding Style
- Documentation
- Use of best practices
- Language-specific issues
- Use of deprecated methods
- Performance (e.g., complexity of the solution)
- Alternative solutions…
اشتراکها
آینده #C به نقل از طراحان آن
The future of C#
Over the last year we shipped no less than three "point releases" of C# (7.1, 7.2 and 7.3), full of small but useful language features. Mads and Dustin will race you through a tour of these, before turning to some of the big things we have in store for the future: Nullable reference types, recursive patterns, asynchronous streams and more.
This repo contains the samples that demonstrate the API usage patterns and popular features for the Windows Presenation Foundation in the .NET Framework for Desktop. These samples were initially hosted on MSDN, and we are gradually moving all the interesting WPF samples over to GitHub.All the samples have been retargeted to .NET 4.5.2.
اشتراکها
معماری سرویس گرا در دات نت
اشتراکها
معرفی Scala برای توسعهدهندگان #C
سایت زبان برنامهنویسی Scala
Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application.
نظرات مطالب
معرفی List Patterns Matching در C# 11
یک نکتهی تکمیلی: ایجاد نوعهای سازگار با List Patterns Matching
در انتهای این مطلب در مورد «سایر نوعهایی که توسط List patterns قابل بررسی هستند» توضیحات مختصری عنوان شد. کامپایلر #C در جهت یافتن نوعهای سازگار با List Patterns Matching، به دنبال اینترفیس خاصی نمیگردد؛ بلکه به دنبال وجود یک سری اعضای خاص، در کلاس مدنظر است و این اعضاء به شرح زیر هستند:
الف) نوع مدنظر باید به همراه یکی از خواص Length و یا Count باشد تا تعداد اعضای مجموعه را مشخص کند. اگر هر دو خاصیت با هم حضور داشته باشند، کامپایلر خاصیت Length را انتخاب میکند:
ب) نوع مجموعهای باید به همراه یک ایندکسر باشد که نوع خروجی آن مهم نیست. اگر در نوع تعریف شده، هر دو امضای زیر وجود داشته باشند، کامپایلر از نمونهی this[Index index] استفاده میکند:
ج) نوع مجموعهای باید از slice pattern، توسط یکی از امضاهای زیر که نوع خروجی آن مهم نیست، پشتیبانی کند. اگر هر دو با هم حضور داشته باشند، کامپایلر از this[System.Range index] استفاده میکند:
برای مثال با توجه به نکات فوق، نوع جدید زیر، با List Patterns Matching سازگاری دارد:
و نمونهای از نحوهی استفادهی از آن به صورت زیر است:
در انتهای این مطلب در مورد «سایر نوعهایی که توسط List patterns قابل بررسی هستند» توضیحات مختصری عنوان شد. کامپایلر #C در جهت یافتن نوعهای سازگار با List Patterns Matching، به دنبال اینترفیس خاصی نمیگردد؛ بلکه به دنبال وجود یک سری اعضای خاص، در کلاس مدنظر است و این اعضاء به شرح زیر هستند:
الف) نوع مدنظر باید به همراه یکی از خواص Length و یا Count باشد تا تعداد اعضای مجموعه را مشخص کند. اگر هر دو خاصیت با هم حضور داشته باشند، کامپایلر خاصیت Length را انتخاب میکند:
public int Length { get; } public int Count { get; }
ب) نوع مجموعهای باید به همراه یک ایندکسر باشد که نوع خروجی آن مهم نیست. اگر در نوع تعریف شده، هر دو امضای زیر وجود داشته باشند، کامپایلر از نمونهی this[Index index] استفاده میکند:
public object this[int index] => throw null; public object this[System.Index index] => throw null;
ج) نوع مجموعهای باید از slice pattern، توسط یکی از امضاهای زیر که نوع خروجی آن مهم نیست، پشتیبانی کند. اگر هر دو با هم حضور داشته باشند، کامپایلر از this[System.Range index] استفاده میکند:
public object this[System.Range index] => throw null; public object Slice(int start, int length) => throw null;
برای مثال با توجه به نکات فوق، نوع جدید زیر، با List Patterns Matching سازگاری دارد:
public class MyListPatternsCompatibleCollection { private readonly List<int> _items = new(); public int Length => _items.Count; public int this[Index index] => _items[index]; public ReadOnlySpan<int> this[Range range] => CollectionsMarshal.AsSpan(_items)[range]; public void Add(int item) => _items.Add(item); }
var collection = new MyListPatternsCompatibleCollection(); collection.Add(1); collection.Add(2); collection.Add(3); _ = collection is [var head, .. var tail];
منابعی برای مطالعهی بیشتر
- Conditional INSERT/UPDATE Race Condition
- “UPSERT” Race Condition With MERGE
- آسیبپذیری Race Condition در آکادمی لیان
- Race Condition in Web Application
- Processing Data Queues in SQL Server with READPAST and UPDLOCK
- PostgreSQL anti-patterns: read-modify-write cycles
- PHP Race Condition Vulnerability Example
- Application Locks (or Mutexes) in SQL Server 2005
- Handle Race Conditions / Concurrency in Code First Entity Framework Applications
سلام؛ من بعد از انتقال کانتکس و کلاسهای مدل به اسمبلیهای خودشون اقدام به اضافه کردن مهاجرتها کردم ولی با خطای زیر مواجه شدم :
ضمنا سازنده کانتکست:
دستور اضافه کردن مهاجرتها:
Unable to create an object of type 'ApplicationDbContext'. Add an implementation of 'IDesignTimeDbContextFactory<ApplicationDbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.
public ApplicationDbContext(DbContextOptions options) : base(options) { }
dotnet ef --startup-project ../MohasebKhodro/ migrations add InitialDatabase