C3D.Core.DataAccess.Extensions.EF6 7.5.166-ci-20211019-034334

This is a prerelease version of C3D.Core.DataAccess.Extensions.EF6.
dotnet add package C3D.Core.DataAccess.Extensions.EF6 --version 7.5.166-ci-20211019-034334
NuGet\Install-Package C3D.Core.DataAccess.Extensions.EF6 -Version 7.5.166-ci-20211019-034334
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="C3D.Core.DataAccess.Extensions.EF6" Version="7.5.166-ci-20211019-034334" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add C3D.Core.DataAccess.Extensions.EF6 --version 7.5.166-ci-20211019-034334
#r "nuget: C3D.Core.DataAccess.Extensions.EF6, 7.5.166-ci-20211019-034334"
#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.
// Install C3D.Core.DataAccess.Extensions.EF6 as a Cake Addin
#addin nuget:?package=C3D.Core.DataAccess.Extensions.EF6&version=7.5.166-ci-20211019-034334&prerelease

// Install C3D.Core.DataAccess.Extensions.EF6 as a Cake Tool
#tool nuget:?package=C3D.Core.DataAccess.Extensions.EF6&version=7.5.166-ci-20211019-034334&prerelease

C3D.Core.DataAccess.Extensions.EF6

Build Status NuGet package NuGet downloads

This project contains the code for some EF6 extensions which make it easier to scan assemblies for entity model types, and for ComplexTypeConfiguration<> and EntityTypeConfiguration<> types.

Quick Start

  • Install the Nuget package or copy this code into your project.
  • Ensure your DBContext class has using System.Data.Entity.ModelConfiguration;
  • In your OnModelCreating method use the extension methods
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    modelBuilder.Configurations.GetTypesFromAssemblyType<C3D.Core.Models.Audit.Conventions.AuditTypesDefaultsConvention>().Add();
}

In this example the generic type is a type from the assembly I want to import from.

There are quite a few overloads/variations and parameters. The code documents some of them.

An example is

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    modelBuilder.Configurations.AddFromAssembly(typeof(SomeRandomType).Assembly,"My.Random.NameSpace");
}

This will add all CTC and ETC types from the assembly containing SomeRandomType where the configuration type itself or the entity model type it is configuring is in the namespace My.Random.NameSpace.

e.g. this will match both

namespace My.Random.NameSpace.ETC {
    public class MyTypeConfiguration : EntityTypeConfiguration<My.Model.NameSpace.MyType> {

    }
}

and

namespace My.Configuration.NameSpace {
    public class MyTypeConfiguration : EntityTypeConfiguration<My.Random.NameSpace.Models.MyType> {

    }
}

Example

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);

    List<ITypeInfo> typeInfos = new();
    typeInfos.AddRange(modelBuilder.Configurations.GetTypesFromAssemblyType<C3D.Core.Models.Audit.Conventions.AuditTypesDefaultsConvention>());
    typeInfos.AddRange(modelBuilder.Configurations.GetTypesFromAssemblyType(this.GetType()));
    typeInfos.ForEach(typeInfo => Log.InfoFormat("Detected TC {0}", typeInfo));
    typeInfos.Add();
}

TODO

Better documentation, code documentation and add tests

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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net461 is compatible.  net462 was computed.  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)
Additional computed target framework(s)
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
7.5.166-ci-20211019-034334 201 10/19/2021