<commit_before>Manually adding and maintaining EntityFramework type configurations can be a pain. <NAME> wrote [a great blog](http://odetocode.com/blogs/scott/archive/2011/11/28/composing-entity-framework-fluent-configurations.aspx) post showing how to use MEF in order to add configurations in a scalable way. This library packages the provided approach into a reusable extension method and utility class.

[![Build status](https://ci.appveyor.com/api/projects/status/vpjnu4fhpkvq6pvk)](https://ci.appveyor.com/project/hhorne/efmodelcomposer)

**Example Usage** 

	class FooContext : DbContext
	{
		...
		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			modelBuilder.ComposeModelConfiguration(Assembly.GetExecutingAssembly());
			base.OnModelCreating(modelBuilder);
		}
		...
	}
	
	class City
	{
		public int Id { get; set; }
		public string Name { get; set; }
	}

	[ExportConfiguration]
	class CityConfig : EntityConfiguration<City>
	{
		public CityConfig()
		{
			Property(c => c.Name).HasMaxLength(100);
		}
	}

Once your DbContext is configured to call the ComposeModelConfiguration extension method any exported EntityConfiguration (a derived type of EntityTypeConfiguration) will be automatically found and loaded when OnModelCreating is called.<commit_msg>Updated intro and added nuget info to readme<commit_after>##EfModelComposer

Manually adding and maintaining EntityFramework type configurations can be a pain. <NAME> wrote [a great blog post](http://odetocode.com/blogs/scott/archive/2011/11/28/composing-entity-framework-fluent-configurations.aspx) showing how to use MEF in order to add configurations in a scalable way. This library packages the provided approach into a pluggable way.

[![Build status](https://ci.appveyor.com/api/projects/status/vpjnu4fhpkvq6pvk)](https://ci.appveyor.com/project/hhorne/efmodelcomposer)

**Install from Nuget**

	Install-Package EfModelComposer

**Example Usage** 

	class FooContext : DbContext
	{
		...
		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			modelBuilder.ComposeModelConfiguration(Assembly.GetExecutingAssembly());
			base.OnModelCreating(modelBuilder);
		}
		...
	}
	
	class City
	{
		public int Id { get; set; }
		public string Name { get; set; }
	}

	[ExportConfiguration]
	class CityConfig : EntityConfiguration<City>
	{
		public CityConfig()
		{
			Property(c => c.Name).HasMaxLength(100);
		}
	}

Once your DbContext is configured to call the ComposeModelConfiguration extension method any exported EntityConfiguration (a derived type of EntityTypeConfiguration) will be automatically found and loaded when OnModelCreating is called.
{'fraction_non_alphanumeric': 0.08909774436090226, 'fraction_numerical': 0.009774436090225564, 'mean_word_length': 4.900221729490022, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5947288', 'n_tokens_mistral': 832, 'n_tokens_neox': 747, 'n_words': 224}