- tracked entities are saved during
SaveChanges()
call - entities being tracked when they are:
- returned from DB
- attached to context
- added as subentity
- tracking can be disabled (
AsNoTracking()
i.e.)
Further read:
About coding and whatnot
SaveChanges()
callAsNoTracking()
i.e.)Further read:
customer.Address
loads Address of a customer in the background via separate SQL queryContext.Configuration.LazyLoadingEnabled = false;
.Include()
queryFurther read:
https://www.entityframeworktutorial.net/lazyloading-in-entity-framework.aspx
https://www.entityframeworktutorial.net/eager-loading-in-entity-framework.aspx
Pattern matching is used for:
Examples:
a is int number
sequence is IList<T> list
switch statement:
command switch { Operation.SystemTest => RunDiagnostics(), Operation.Start => StartSystem(), Operation.Stop => StopSystem(), Operation.Reset => ResetToReady(), _ => throw new ArgumentException("Invalid enum value for command", nameof(command)), };
switch with ranges:
tempInFahrenheit switch { (> 32) and (< 212) => "liquid", < 32 => "solid", > 212 => "gas", 32 => "solid/liquid transition", 212 => "liquid / gas transition", };
collection pattern matching:
array is [1,1,2,3,5,8, ..]
Further read:
https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/pattern-matching
Further read:
https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/reflection
Type | Command |
---|---|
framework-dependent executable for the current platform. | dotnet publish |
framework-dependent executable for a specific platform. | dotnet publish -r <RID> --self-contained false |
framework-dependent binary. | dotnet publish |
self-contained executable. | dotnet publish -r <RID> |
Further read:
https://learn.microsoft.com/en-us/dotnet/core/deploying/#publish-framework-dependent