Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
جلسه هفتم
- از این جلسه، به طور رسمی وارد EF Core 8 میشویم!
Cheat Sheet
1. Code First
2. Entity Framework (EF) / Entity Framework Core (EF Core)
3. LINQ
DataAnnotations
Standard (Default) Conventions in EF / EF Core
// Best Practice
public int Id { get; set; }
public int ID { get; set; }
public int [ClassName]Id { get; set; }
public int [ClassName]ID { get; set; }
[System.ComponentModel.DataAnnotations.Key]
public int Code { get; set; }
public int Id { get; set; }
public long Id { get; set; }
// Best Practice
public System.Guid Id { get; set; }LINQ Philosophy
You should install:
- Microsoft SQL Server Developer Edition!
- Microsoft SQL Server Management Studio (SSMS)
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد ✅
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_007
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤29👍14
Media is too big
VIEW IN TELEGRAM
جلسه اول
- نحوه (دریافت / ارسال) سورسکدها، (از / به) سایتهایی مانند Github, Gitlab و غیره، با استفاده از پروتکل SSH
Cheat Sheet
- SSH: Secure Shell or Secure Socket Shell
- You must run below commands in Git Bash:
clear
cd ~
pwd
ls -la
rm -rf .ssh
ssh-keygen -t ed25519 -C "YOUR_EMAIL_ADDRESS"
ls -la ~/.ssh
cat ~/.ssh/id_ed25519.pub
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
git clone git@github.com:[YOUR_ACCOUNT]/[YOUR_REPOSITORY].git
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد ✅
#SSH #GIT #GITHUB #GITLAB #SSH_001
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤21👍1
https://www.microsoft.com/software-download/windows11
https://rufus.ie/en
https://ubuntu.com/download/desktop
https://etcher.balena.io
زمانی که یک Flash، به حجم مثلا ۳۲ گیگا بایت خریداری میکنیم، متاسفانه با هر یک از دو نرمافزار Rufus و balenaEtcher فوق، حداکثر میتوانیم، یک فایل ISO را بر روی Flash منتقل کرده و Flash مربوطه را Bootable نماییم! و اگر حجم فایل ISO، مثلا حدود ۶ گیگا بایت باشد، بیش از ۲۶ گیگا بایت، از فضای Flash بلااستفاده خواهد ماند!
https://www.ventoy.net/en/download.html
〰️ این نرمافزار Portable بوده و کاملا رایگان و Open Source میباشد!
〰️ بعد از دانلود و Extract نمودن آن، فایل Ventoy2Disk.exe را اجرا میکنیم و بر روی دکمه Install کلیک میکنیم، تا برنامه Ventoy بر روی Flash ما نصب شود.
〰️ پس از Install شدن، یک Drive، با فضای خالی، بر روی Flash خواهیم داشت و میتوانیم به سادگی فایلهای ISO ای که قبلا دانلود کردهایم، در داخل این Drive، کپی نماییم!
〰️ زمانی که این Flash را به سیستمی متصل نموده و سیستم را از طریق این Flash راهاندازی (Boot) میکنیم، برنامه Ventoy، اجرا شده و فهرستی از تمام فایلهای ISO موجود در درونش را به ما نمایش میدهد.
〰️ حال میتوانیم، فایل ISO مورد نظر را انتخاب کرده، و سیستم مورد نظر خودمان را بر روی سیستممان نصب نماییم!
#Software #Site #Ventoy #Rufus #BalenaEtcher
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
👍38❤24
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
<ItemGroup>
<PackageReference Include=
"Microsoft.EntityFrameworkCore.SqlServer"
Version="8.0.1" />
</ItemGroup>
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var applicationDbContext =
new ApplicationDbContext();
var category =
new Category
{
Name = "My Category",
};
applicationDbContext.Categories.Add(entity: category);
applicationDbContext.SaveChanges();
applicationDbContext.Dispose();
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext() : base()
{
Database.EnsureCreated();
}
/// <summary>
/// Table Name -> Categories
/// </summary>
public DbSet<Category> Categories { get; set; }
protected override void OnConfiguring
(DbContextOptionsBuilder optionsBuilder)
{
var connectionString = "...";
optionsBuilder.UseSqlServer
(connectionString: connectionString);
}
}
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد ✅
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_008
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤29👍3
انشاءالله همیشه سلامت و تندرست باشید، و انشاءالله سودهای خوبی از این سایت کسب نمایید...
با تشکر و احترام
داریوش تصدیقی
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
https://vrgl.ir/LPFeg
یک هدیه ویژه! کسب درآمد دلاری از اینترنت!
Please open Telegram to view this post
VIEW IN TELEGRAM
❤32👍8
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
CRUD:
Create
Update
Delete
Retrieve:
Zero or One (FirstOrDefault)
Zero or Many (ToList)
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
1. Create: (Semi) Best Practice!
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
try
{
using var applicationDbContext = new ApplicationDbContext();
var category =
new Category
{
Name = "My Category",
};
applicationDbContext.Add(entity: category);
applicationDbContext.SaveChanges();
}
catch (System.Exception ex)
{
System.Console.WriteLine(value: ex.Message);
}
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_009
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤34👍5
Media is too big
VIEW IN TELEGRAM
- مقدمه و فلسفه
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
#Github #GithubPages #Github_Pages #Cloudflare #Nic_Ir
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤30👍8
Media is too big
VIEW IN TELEGRAM
- راهاندازی سرویس Pages در سایت Github
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
#Github #GithubPages #Github_Pages #Cloudflare #Nic_Ir
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤25👍6
Media is too big
VIEW IN TELEGRAM
- اتصال دامنه شخصی از سایت nic.ir به سایت Cloudflare
- اتصال سایت Cloudflare به سایت Github
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
#Github #GithubPages #Github_Pages #Cloudflare #Nic_Ir
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤28👍7
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
nameof(Id)
category == null => category is null
Find(...) => FirstOrDefault(...)
FirstOrDefault([Predict])
=>
.Where([Predict])
.FirstOrDefault()
(x => x.Id == 1)
=>
(category => category.Id == 1)
[OR]
(current => current.Id == 1)
var search =
"My Category".ToLower();
.Where(predicate: current => current.Name != null
&& current.Name.ToLower() == search)
.Where(predicate: current => current.Name != null
&& current.Name.ToLower().Contains(search))
.Where(predicate: current => current.Name != null
&& current.Name.ToLower().EndsWith(search))
.Where(predicate: current => current.Name != null
&& current.Name.ToLower().StartsWith(search))
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_010
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤26👍4
Install_2_8.bat
27.6 KB
یک یادگاری ارزشمند، تقدیم به همه عزیزان ایرانی...
https://news.1rj.ru/str/IranianExperts/823
#WinGet #Install
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤34👍4
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
- ToList (Zero or Many)
- Check is there any records (Categories) in Table?
- In three ways!
- Transaction
- Create 9 records (Categories):
- Transactional
- Non-Transactional
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_011
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤32👍5
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
// ToList() -> using System.Linq;
var categories =
applicationDbContext.Categories
.ToList()
;
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var categories =
applicationDbContext.Categories
.Where(predicate:
current => current.Id <= 6 && current.IsActive)
.ToList()
;
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var categories =
applicationDbContext.Categories
.Where(predicate: current => current.Id <= 6)
.Where(predicate: current => current.IsActive)
.ToList()
;
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var categories =
applicationDbContext.Categories
.Where(predicate: current => current.Id <= 6)
.Where(predicate: current => current.IsActive)
.Where(predicate: current => current.Name != null &&
current.Name.ToLower().Contains(search.ToLower()))
.ToList()
;
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
- Best Practice:
First: Where(...) - Then: OrderBy...
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var categories =
applicationDbContext.Categories
.Where(predicate: current => current.Id <= 6)
.OrderBy(keySelector: current => current.IsActive)
.ToList()
;
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
OrderBy
ThenBy
ThenBy...
OrderByDescending
ThenBy
ThenBy...
OrderBy
ThenByDescending
ThenBy...
OrderByDescending
ThenByDescending
ThenBy...
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_012
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤31👍5
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
Update One Record
Update More Than One Record
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
C# Technique:
{
...
int index = 1;
...
}〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
applicationDbContext〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
.Entry(entity: someEntity).State: Get / Set:
EntityState.Detached;
EntityState.Added;
EntityState.Unchanged;
EntityState.Modified;
EntityState.Deleted;
〰️
var sql =
"UPDATE Categories SET IsActive = 1 WHERE IsActive = 0";
var affectedRows =
applicationDbContext.Database.ExecuteSqlRaw(sql: sql);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var affectedRows =
applicationDbContext.Categories
.Where(current => current.IsActive == false)
.ExecuteUpdate(setters =>
setters.SetProperty(property => property.IsActive, true));
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var foundedCategory =
applicationDbContext.Categories
.AsNoTracking()
.FirstOrDefault() [OR] .ToList();
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var theCategory =
new Category
{
Id = 1,
...
};
applicationDbContext
.Entry(entity: theCategory).State = EntityState.Modified;
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
applicationDbContext.SaveChanges();
var affectedRows =
applicationDbContext.SaveChanges();
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_013
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤35👍4
Media is too big
VIEW IN TELEGRAM
توسط این محصول میتوانیم با امنیت 4096 بیتی، و با استفاده از الگوریتم رمزنگاری نامتقارن (Asymmetric Encryption)، برای امن نمودن یک پیغام (Message)، برای ارسال بین دو نقطه از جهان! و یا حتی بر روی رایانه شخصیمان استفاده نماییم!
- Free
- Clean Code
- Open Source
- Cross Platform
- With .NET 8.x
- With C# Language
- Without any third-party NuGets
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/SecureMessages
#CyberSecurity #Cyber_Security #Encryption #Symetric #Asymetric #SecureMessage #SecureMessages
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤33👍9
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
Update One Record
Update More Than One Record
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
applicationDbContext.Update(entity);
applicationDbContext.Categories.Update(entity);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
applicationDbContext.Remove(entity);
applicationDbContext.Categories.Remove(entity);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
applicationDbContext.RemoveRange
(category1, category2, category3, ...);
applicationDbContext
.RemoveRange(entities: foundedCategories);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var sql =
"DELETE Categories WHERE IsActive = 0";
var affectedRows =
applicationDbContext.Database.ExecuteSqlRaw(sql: sql);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var affectedRows =
applicationDbContext.Categories
.Where(current => current.IsActive == false)
.ExecuteDelete();
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var foundedCategory =
applicationDbContext.Categories
.FirstOrDefault();
// State: Unchanged
var foundedCategory =
applicationDbContext.Categories
.AsNoTracking()
.FirstOrDefault();
// State: Detached
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
var theCategory =
new Category
{
Id = 1,
...
};
applicationDbContext.Entry
(entity: theCategory).State = EntityState.Deleted;
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_014
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤36👍5
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
- Quiz!
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_015
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤24👍9
- شرکت پندار پژوه، با بیش از ۲۰ سال تجربه، با رویکرد طراحی و پیادهسازی سیستمهای سفارش مشتری، در زمینه توسعه و تولید نرمافزارهای حوزه سلامت، و همچنین حوزه مخابرات، که با طراحی و توسعه نرمافزارهای کاربردی، بخش بزرگی از مشکلات زیرساخت مخابراتی کشور و همچنین مشکلات زیرساخت سلامت، مانند کمبود دارویی را برطرف کرده است، به منظور گسترش تیم اجرایی خود در سال جدید، نیازمند علاقمندان حوزه نرمافزار با تواناییهای ذیل میباشد:
✴️ مهارت های عمومی
- روحیه کار تیمی
- رفتار حرفه ایی
- توانایی حل مسئله و تصمیم گیری
✴️ مهارت های تخصصی
- مسلط به #C و مفاهیم شی گرایی
- مسلط به dot net core 7
- مسلط به کوئرینویسی SQL
- مسلط به docker
- مسلط به git
- آشنایی با مفاهیم DDD
- آشنایی با مفاهیم SOLID
- آشنایی با Trello مزیت محسوب می شود
- آشنایی با Frontend مزیت محسوب می شود
- حداقل دو سال، سابقه کار مرتبط
✴️ مزایای شغلی
- پرداخت به موقع حقوق
- بیمه تامین اجتماعی
- محیط دوستانه
- پاداشهای موردی با توجه به عملکرد
❇️ ارسال رزومه به آدرس ذیل:
Kalanaki@pendarpajouh.com
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤12👍9
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
- (Semi) Best Practice!
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
await
applicationDbContext
.Categories.AnyAsync();
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
await
applicationDbContext
.SaveChangesAsync();
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
- GenerationStrategy.SequenceHiLo
await
applicationDbContext
.AddAsync(entity: category);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
public abstract class Entity : object
{
protected Entity() : base()
{
}
}
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
//public int Id { get; set; }
//public Guid Id { get; set; }
public Guid Id { get; private set; }〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
//Id = new Guid();
Id = Guid.NewGuid();
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
//public DateTime InsertDateTime
// { get; private set; }
public DateTimeOffset InsertDateTime
{ get; private set; }
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
- Attributes:
[System.ComponentModel.DataAnnotations.Key]
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
[System.ComponentModel.DataAnnotations.Schema
.DatabaseGenerated(databaseGeneratedOption:
System.ComponentModel.DataAnnotations
.Schema.DatabaseGeneratedOption.None)]
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
//[System.ComponentModel.DataAnnotations.Required]
[System.ComponentModel.DataAnnotations.Required
(AllowEmptyStrings = false)]
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
[System.ComponentModel.DataAnnotations.MaxLength
(length: 100)]
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_016
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
Please open Telegram to view this post
VIEW IN TELEGRAM
❤23👍7
سلام دوستان عزیزم
با تجدید احترام
داریوش تصدیقی
#Solidity #SmartContract #Smart_Contract #CyberSecurity #Cyber_Security #Blockchain #Cryptocurrency
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤66👍15
Forwarded from DTX_LEARNING_EF_CORE (𝓓𝓪𝓻𝓲𝓾𝓼𝓱 𝓣𝓪𝓼𝓭𝓲𝓰𝓱𝓲)
Media is too big
VIEW IN TELEGRAM
Cheat Sheet
- Fluent API
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
internal class CategoryConfiguration
: IEntityTypeConfiguration<Category>
public void Configure
(Metadata.Builders
.EntityTypeBuilder<Category> builder)
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
builder
.HasKey(current =>
current.Id)
.IsClustered
(clustered: false);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
builder
.Property(current =>
current.Name)
.IsUnicode(unicode: false);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
builder
.HasIndex(current =>
new { current.Name })
.IsUnique(unique: true);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
- Override:
OnModelCreating()
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
modelBuilder
.Entity<Category>()
.Property(current => current.Name)
.IsUnicode(unicode: false);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
modelBuilder.ApplyConfiguration
(configuration:
new CategoryConfiguration());
new CategoryConfiguration()
.Configure(builder:
modelBuilder.Entity<Category>());
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
modelBuilder.ApplyConfigurationsFromAssembly
(assembly: System.Reflection
.Assembly.GetExecutingAssembly());
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
modelBuilder.ApplyConfigurationsFromAssembly
(assembly: typeof
(ApplicationDbContext).Assembly);
〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️ 〰️
✅ انتشار این فیلم، با ذکر منبع، بلامانع میباشد
☘️ سورسکد پروژه:
https://github.com/Dariush-Tasdighi/Learning-EF-Core-8
#EFCore #EF_CORE #NEW_LEARNING_EF_CORE_017
🆔 @Dariush_Tasdighi
🆔 @IranianExperts
🆔 @DT_PYTHON_LEARNING
Please open Telegram to view this post
VIEW IN TELEGRAM
❤23👍3