SimplePatch icon indicating copy to clipboard operation
SimplePatch copied to clipboard

Support for init config from assembly by typed class configuration

Open zach88 opened this issue 6 years ago • 2 comments

when entities are made with code generator, is more easy decor properties with attributes than make a fluent config, so I added a exclude attribute to decor properties.

zach88 avatar Apr 28 '19 03:04 zach88

to decouple the configuration of each entity and avoid adding each entity at init, it is now possible to create configuration files in Entity Framework style, so you only need specify the assembly that you want SimplePatch scan and config for you, base on your config files

Startup

	var assembly = typeof(Person).Assembly;
	DeltaConfig.InitFromAssembly(cfg => {
		cfg.AddAssembly(assembly);
	});

Config file

    public class PersonConfiguration : Mapping.IEntityTypeConfiguration<Person>
    {
        public void Configuration(DeltaConfig.EntityConfig<Person> entityConfig)
        {
            entityConfig.Property(x => x.AgeExcludeByMapping).Exclude();
        }
    }

zach88 avatar Jun 17 '19 16:06 zach88

@OmarMuscatello any comments?

zach88 avatar Jul 03 '19 17:07 zach88