public static FluentMappingBuilder AddAssociation <TOne, TMany>(this FluentMappingBuilder fluentMappingBuilder , Expression <Func <TOne, TMany> > prop1 , Expression <Func <TMany, IEnumerable <TOne> > > prop2 , Expression <Func <TOne, TMany, bool> > predicate ) { var prop1CanBeNull = typeof(TOne).GetProperty(prop1.GetMemberInfo().Name).IsNullable(); var prop2CanBeNull = typeof(TMany).GetProperty(prop2.GetMemberInfo().Name).IsNullable(); fluentMappingBuilder.Entity <TOne>().Association(prop1, predicate, prop1CanBeNull); fluentMappingBuilder.Entity <TMany>().Association(prop2, predicate.SwapParameters1(), prop2CanBeNull); return(fluentMappingBuilder); }
public static FluentMappingBuilder BuildMappingSchema(ISqlDbJobQueueTableConfiguration _jobQueueTableConfiguration) { var mapper = new LinqToDB.Mapping.FluentMappingBuilder(MappingSchema.Default); mapper.Entity <SqlCommonDbOddJobMetaData>().HasAttribute( new TableAttribute(_jobQueueTableConfiguration.QueueTableName) { IsColumnAttributeRequired = false, Name = _jobQueueTableConfiguration.QueueTableName }); mapper.Entity <SqlCommonOddJobParamMetaData>().HasAttribute( new TableAttribute(_jobQueueTableConfiguration.ParamTableName) { IsColumnAttributeRequired = false, Name = _jobQueueTableConfiguration.ParamTableName }); mapper.Entity <SqlDbOddJobMethodGenericInfo>().HasAttribute( new TableAttribute(_jobQueueTableConfiguration.JobMethodGenericParamTableName) { IsColumnAttributeRequired = false, Name = _jobQueueTableConfiguration.JobMethodGenericParamTableName }); return(mapper); }
/// <summary> /// Creates entity builder for specified mapping type. /// </summary> /// <typeparam name="TE">Mapping type.</typeparam> /// <param name="configuration">Optional mapping schema configuration name, for which this entity builder should be taken into account. /// <see cref="ProviderName"/> for standard configuration names.</param> /// <returns>Returns new fluent entity mapping builder.</returns> public EntityMappingBuilder <TE> Entity <TE>(string?configuration = null) { return(_builder.Entity <TE>(configuration)); }