LazyEntityGraph.EntityFramework 2.5.0

dotnet add package LazyEntityGraph.EntityFramework --version 2.5.0
                    
NuGet\Install-Package LazyEntityGraph.EntityFramework -Version 2.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LazyEntityGraph.EntityFramework" Version="2.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LazyEntityGraph.EntityFramework" Version="2.5.0" />
                    
Directory.Packages.props
<PackageReference Include="LazyEntityGraph.EntityFramework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LazyEntityGraph.EntityFramework --version 2.5.0
                    
#r "nuget: LazyEntityGraph.EntityFramework, 2.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LazyEntityGraph.EntityFramework@2.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LazyEntityGraph.EntityFramework&version=2.5.0
                    
Install as a Cake Addin
#tool nuget:?package=LazyEntityGraph.EntityFramework&version=2.5.0
                    
Install as a Cake Tool

Build status NuGet version

LazyEntityGraph

LazyEntityGraph is the successor to AutoEntityFramework. This project aims to both improve upon the functionality of the original, and open the door to integration with other test object creators and ORMs.

What's New?

The key benefits of LazyEntityGraph over AutoEntityFramework are:

  • Extensible architecture: AutoFixture and Entity Framework integration is available through extensions; similarly it would be possible to create extensions for NHibernate, ObjectHydrator, etc
  • Constrained relationships: Specify one-to-one, one-to-many or many-to-many relationships between entities and the generation process will respect those relationships
  • Entity Framework integration: Automatically generate model metadata from EDMX or Code First DbContexts, including foreign keys

For documentation, see this wiki page

Objective

When writing tests, we often need to create test objects without necessarily caring about the data used to populate them. There are many projects which accomplish this in .NET, among them AutoFixture, ObjectHydrator, NBuilder and more.

Also popular in the .NET world are ORMs: libraries used to bridge the gap between data and code by representing relational data as C# objects. The most popular of these are Entity Framework and NHibernate. These produce graphs of classes linked by relationship properties.

public class Order
{
  public int Id { get; set; }
  public virtual ICollection<Product> Products { get; set; }
}

public class Product
{
  public int Id { get; set; }
  public virtual ICollection<Order> Orders { get; set; }
}

However, if you are using a test object creation library like AutoFixture, you will run into a problem when trying to create an instance of the Order class above: the circular reference between Product and Order.

When using the ORM to retrieve one of these objects, you typically don't want to retrieve the entire object graph...! For this reason, relationship properties are often marked virtual, to enable them to be lazy-loaded.

So, we come to the purpose of this library: to permit test object creation tools like AutoFixture to create entity graphs with circular references.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.5.0 27 3/29/2026
2.4.0 4,365 1/22/2023
2.4.0-pre2 312 12/16/2022
2.3.5 32,282 10/31/2020
2.3.4 812 7/2/2020
2.3.4-pre1 595 7/2/2020
2.3.1 16,547 5/27/2020
2.3.0 873 4/12/2020
2.3.0-pre1 614 4/12/2020
2.3.0-build68 621 4/12/2020
2.2.0 43,862 10/12/2018
2.2.0-pre1 863 10/10/2018
2.1.0 1,711 7/4/2018
2.1.0-pre4 1,310 7/4/2018
2.1.0-pre3 1,134 7/4/2018
2.1.0-pre2 1,323 7/4/2018
2.0.2 2,624 6/6/2018
2.0.1 1,570 5/14/2018
2.0.0 2,195 5/8/2018
1.0.0 20,368 6/8/2016

Add support for .NET 8