/// <summary>
        /// Creates entity mapping builder.
        /// </summary>
        /// <param name="builder">Fluent mapping builder.</param>
        /// <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>
        public EntityMappingBuilder(FluentMappingBuilder builder, string?configuration)
        {
            _builder = builder ?? throw new ArgumentNullException(nameof(builder));

            Configuration = configuration;

            // We'll reset cache here, because there is no need to create builder if you don't want to change something
            _builder.MappingSchema.ResetEntityDescriptor(typeof(TEntity));
        }
Пример #2
0
        public EntityMappingBuilder([JetBrains.Annotations.NotNull] FluentMappingBuilder builder, string configuration)
        {
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }

            _builder      = builder;
            Configuration = configuration;
        }
Пример #3
0
        /// <summary>
        /// Creates enity mapping builder.
        /// </summary>
        /// <param name="builder">Fluent mapping builder.</param>
        /// <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>
        public EntityMappingBuilder([JetBrains.Annotations.NotNull] FluentMappingBuilder builder, string configuration)
        {
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }

            _builder      = builder;
            Configuration = configuration;

            // We'll reset cache here, because there is no need to create builder if you don't want to change something
            _builder.MappingSchema.ResetEntityDescriptor(typeof(T));
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        /// <summary>
        /// Creates entity mapping builder.
        /// </summary>
        /// <param name="builder">Fluent mapping builder.</param>
        /// <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>
        public EntityMappingBuilder(FluentMappingBuilder builder, string?configuration)
        {
            _builder = builder ?? throw new ArgumentNullException(nameof(builder));

            Configuration = configuration;
        }