GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing entityframework-plus.net — Entity Framework Plus Entity Framework Plus A FREE & Open Source library to enhance EF6 and EF Core
Community FeaturesThose features are free (even for commercial use) and will always be:
Enterprise FeaturesThose features are paid and a part of the EF Extensions library: We need your help to support EF Plus!
EF Plus is FREE and always will be.
> 3,000+ Requests answered per year
> $100,000 USD investment per year
> 500 Commits per year
> 100 Releases per year
Auditing Improve
Auditing Examplevar audit = new Audit();
audit.CreatedBy = "ZZZ Projects"; // Optional
ctx.SaveChanges(audit);
// Access to all auditing information
var entries = audit.Entries;
foreach(var entry in entries)
{
foreach(var property in entry.Properties)
{
}
}
Delete without loading entities Delete rows from LINQ Query in a single database round trip without loading entities in the context.
Batch Delete Example/ DELETE all users inactive for 2 years
var date = DateTime.Now.AddYears(-2);
ctx.Users.Where(x => x.LastLoginDate < date)
.Delete();
// DELETE using a BatchSize
var date = DateTime.Now.AddYears(-2);
ctx.Users.Where(x => x.LastLoginDate < date)
.Delete(x => x.BatchSize = 1000);
Update without loading entities Update rows from LINQ Query in a single database round trip without loading entities in the context.
Batch Update Example// UPDATE all users inactive for 2 years
var date = DateTime.Now.AddYears(-2);
ctx.Users.Where(x => x.LastLoginDate < date)
.Update(x => new User() { IsSoftDeleted = 1 });
Second Level Cache Improve application
Query Cache Example// The first call perform a database round trip var countries1 = ctx.Countries.FromCache().ToList(); // Subsequent calls will take the value from the memory instead var countries2 = ctx.Countries.FromCache().ToList(); Filtering Improve your context
Query Filter ExampleQueryFilterManager.Filter<Post>
(q => q.Where(x => !x.IsSoftDeleted));
var ctx = new EntitiesContext();
// SELECT * FROM Post WHERE IsSoftDeleted = false
var list = ctx.Posts.ToList();
Future & FutureValue Delay queries execution and batch all queries in a single database round trip.
Query Future Example// CREATE a pending list of future queries var futureCountries = db.Countries.Where(x => x.IsActive).Future(); var futureStates = db.States.Where(x => x.IsActive).Future(); // TRIGGER all pending queries in one database round trip // SELECT * FROM Country WHERE IsActive = true; // SELECT * FROM State WHERE IsActive = true var countries = futureCountries.ToList(); // futureStates is already resolved and contains the result var states = futureStates.ToList(); Filter included related entities Overcome Include method limitations by filtering included related entities.
Query IncludeFilter Example// LOAD orders and the first 10 active related entities.
var list = ctx.Orders.IncludeFilter(x => x.Items
.Where(y => !y.IsSoftDeleted)
.OrderBy(y => y.Date)
.Take(10)
)
.ToList();
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |