public class AuditInterceptor : Interceptor<IAuditEntity> { public override void PreInsert(IContext<IAuditEntity> context) { context.Entity.CreatedAt = DateTime.UtcNow; context.Entity.ModifiedAt = DateTime.UtcNow; } public override void PreUpdate(IContext<IAuditEntity> context) { context.Entity.ModifiedAt = DateTime.UtcNow; } } public class MyDbContext : InterceptionDbContext { public MyDbContext() { AddInterceptor(new AuditInterceptor()); } }
نظرات مطالب
EF Code First #3
شما خصوصیتی به نام FK_User_Id در مدل مورد نظر دارید؟ دقیقا باید نام خصوصیت را مشخص کنید. یعنی اگر خصوصیت مورد نظر UserId هست، باید نام آن را قید کنید؛ نه نام دیگری.
با این حال به صورت قراردادی روش زیر جواب میدهد برای دسترسی به کلید خارجی و نیازی به معرفی صریح ندارید:
public calss Test { public User User {get;set;} public int UserId {get;set;} } public class User { public int Id {get;set;} //some properties }
بازخوردهای دوره
تهیه کوئری بر روی ایندکسهای Full Text Search
من از دستور ISABOUT مربوط به CONTAINSTABLE استفاده میکنم مشکلی که دارم اینکه رکوردی در دیتابیس دارم با مقدار "آموزش دیجیتال" سرچی که انجام میدم به شکل زیر ولی نمیدونم چرا خروجی rank مقدار null برمیگردونه
SELECT * FROM News LEFT OUTER JOIN CONTAINSTABLE(news, title, N'ISABOUT("آموزش or دیجیتال" weight(0.9))') AS CT_title ON News.ID = CT_title.[KEY]
در صورتی که اگر به جای or دستور ISABOUT از کاراکتر space استفاده کنم خروجی درست میشه ولی من باید خروجی رو به وسیله or به دست بیارم
اشتراکها
سری آموزش توسعهی وب از تیم کروم
اشتراکها
TypeScript 4.1 منتشر شد
For this release, we have some exciting new features, new checking flags, editor productivity updates, and speed improvements. Let’s get a look at what 4.1 brings!
اشتراکها
npm 7.0 منتشر شد
اشتراکها
TypeScript 4.1 Beta منتشر شد
The 18.6 release is the second major release of SSMS in 2020 and packs several high impact changes , including a fix for crashes in database diagram s. Key fixes include:
- Save to XEL file error fix.
- B acpac file import error fix.
- Database diagrams crash fix.
- Addressed sources o f three common application hangs.