Esempio n. 1
0
        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);
        }
Esempio n. 3
0
 protected override void OnMapping(IMappingBuilder builder)
 {
     builder.Entity<Student>();
     builder.Entity<Course>();
     builder.Entity<School>();
 }
Esempio n. 4
0
 /// <inheritdoc />
 public void FromAssembly(IMappingBuilder builder, Assembly assembly)
 {
     builder.AddMapping(assembly, new FluentMappingsSource(assembly, _log));
 }
Esempio n. 5
0
 /// <inheritdoc />
 public void FromAssemblyOf <T>(IMappingBuilder builder)
 {
     FromAssembly(builder, typeof(T).GetTypeInfo().Assembly);
 }
Esempio n. 6
0
 /// <inheritdoc />
 public void FromAssembly(IMappingBuilder builder, Assembly mappingAssembly)
 {
     builder.AddMapping(mappingAssembly, new AttributeMappingsSource(mappingAssembly, _log));
 }
Esempio n. 7
0
 protected abstract void OnMapping(IMappingBuilder builder);