protected override void OnMapping(IMappingBuilder builder) { builder.Entity<Class>() //.Table("SchoolClass") .Key(_=>_.Id, "Class_id") .Property(_=>_.Name, "ClassName") ; builder.Entity<Student>() .Key(_ => _.Id, "Student_id") //.Property(_=>_.Name, "Name") not required .Reference(_ => _.Class, "Class_id") ; }
/// <summary>Initializes a new instance of the <see cref="DefaultMappingsRepository"/> class.</summary> /// <param name="mappingSources">Collection of mapping sources.</param> /// <param name="mappingsBuilder">Mapping builder.</param> public DefaultMappingsRepository(IEnumerable <IMappingSource> mappingSources, IMappingBuilder mappingsBuilder) { if (mappingSources == null) { throw new ArgumentNullException(nameof(mappingSources)); } if (mappingsBuilder == null) { throw new ArgumentNullException(nameof(mappingsBuilder)); } _openGenericProviders = new ConcurrentDictionary <Type, ICollection <ITermMappingProvider> >(); _mappings = (_mappingBuilder = mappingsBuilder).BuildMappings(mappingSources, _openGenericProviders); }
protected override void OnMapping(IMappingBuilder builder) { builder.Entity<Student>(); builder.Entity<Course>(); builder.Entity<School>(); }
/// <inheritdoc /> public void FromAssembly(IMappingBuilder builder, Assembly assembly) { builder.AddMapping(assembly, new FluentMappingsSource(assembly, _log)); }
/// <inheritdoc /> public void FromAssemblyOf <T>(IMappingBuilder builder) { FromAssembly(builder, typeof(T).GetTypeInfo().Assembly); }
/// <inheritdoc /> public void FromAssembly(IMappingBuilder builder, Assembly mappingAssembly) { builder.AddMapping(mappingAssembly, new AttributeMappingsSource(mappingAssembly, _log)); }
protected abstract void OnMapping(IMappingBuilder builder);