LazyEntityGraph.AutoFixture
2.5.0
dotnet add package LazyEntityGraph.AutoFixture --version 2.5.0
NuGet\Install-Package LazyEntityGraph.AutoFixture -Version 2.5.0
<PackageReference Include="LazyEntityGraph.AutoFixture" Version="2.5.0" />
<PackageVersion Include="LazyEntityGraph.AutoFixture" Version="2.5.0" />
<PackageReference Include="LazyEntityGraph.AutoFixture" />
paket add LazyEntityGraph.AutoFixture --version 2.5.0
#r "nuget: LazyEntityGraph.AutoFixture, 2.5.0"
#:package LazyEntityGraph.AutoFixture@2.5.0
#addin nuget:?package=LazyEntityGraph.AutoFixture&version=2.5.0
#tool nuget:?package=LazyEntityGraph.AutoFixture&version=2.5.0
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 | Versions 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. 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 | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- AutoFixture (>= 4.2.0 && < 5.0.0)
- LazyEntityGraph (>= 2.5.0)
-
.NETStandard 2.0
- AutoFixture (>= 4.2.0 && < 5.0.0)
- LazyEntityGraph (>= 2.5.0)
-
.NETStandard 2.1
- AutoFixture (>= 4.2.0 && < 5.0.0)
- LazyEntityGraph (>= 2.5.0)
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 | 29 | 3/29/2026 |
| 2.4.0 | 11,108 | 1/22/2023 |
| 2.4.0-pre2 | 295 | 12/16/2022 |
| 2.3.5 | 66,540 | 10/31/2020 |
| 2.3.4 | 3,141 | 7/2/2020 |
| 2.3.4-pre1 | 609 | 7/2/2020 |
| 2.3.1 | 16,665 | 5/27/2020 |
| 2.3.0 | 897 | 4/12/2020 |
| 2.3.0-pre1 | 630 | 4/12/2020 |
| 2.3.0-build68 | 638 | 4/12/2020 |
| 2.2.0 | 53,284 | 10/12/2018 |
| 2.2.0-pre1 | 865 | 10/10/2018 |
| 2.1.0 | 5,144 | 7/4/2018 |
| 2.1.0-pre4 | 1,328 | 7/4/2018 |
| 2.1.0-pre3 | 1,298 | 7/4/2018 |
| 2.1.0-pre2 | 1,339 | 7/4/2018 |
| 2.0.2 | 2,699 | 6/6/2018 |
| 2.0.1 | 1,409 | 5/14/2018 |
| 2.0.0 | 2,269 | 5/8/2018 |
| 1.0.0 | 11,435 | 6/8/2016 |
Add support for .NET 8