Beispiel #1
0
        private DbModelBuilder(DbModelBuilder source)
        {
            DebugCheck.NotNull(source);

            _modelConfiguration       = source._modelConfiguration.Clone();
            _conventionsConfiguration = source._conventionsConfiguration.Clone();
            _modelBuilderVersion      = source._modelBuilderVersion;
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Data.Entity.DbModelBuilderVersionAttribute" /> class.
 /// </summary>
 /// <param name="version">
 /// The <see cref="T:System.Data.Entity.DbModelBuilder" /> conventions version to use.
 /// </param>
 public DbModelBuilderVersionAttribute(DbModelBuilderVersion version)
 {
     if (!Enum.IsDefined(typeof(DbModelBuilderVersion), (object)version))
     {
         throw new ArgumentOutOfRangeException(nameof(version));
     }
     this.Version = version;
 }
Beispiel #3
0
 internal DbModelBuilder(
     ModelConfiguration.Configuration.ModelConfiguration modelConfiguration,
     DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest)
     : this(
         modelConfiguration, new ConventionsConfiguration(SelectConventionSet(modelBuilderVersion)),
         modelBuilderVersion)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DbModelBuilder" /> class that will use
 /// a specific set of conventions to discover the initial model.
 /// </summary>
 /// <param name="modelBuilderVersion"> The version of conventions to be used. </param>
 public DbModelBuilder(DbModelBuilderVersion modelBuilderVersion)
     : this(new ModelConfiguration.Configuration.ModelConfiguration(), modelBuilderVersion)
 {
     if (!(Enum.IsDefined(typeof(DbModelBuilderVersion), modelBuilderVersion)))
     {
         throw new ArgumentOutOfRangeException("modelBuilderVersion");
     }
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Data.Entity.DbModelBuilder" /> class that will use
 /// a specific set of conventions to discover the initial model.
 /// </summary>
 /// <param name="modelBuilderVersion"> The version of conventions to be used. </param>
 public DbModelBuilder(DbModelBuilderVersion modelBuilderVersion)
     : this(new System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration(), modelBuilderVersion)
 {
     if (!Enum.IsDefined(typeof(DbModelBuilderVersion), (object)modelBuilderVersion))
     {
         throw new ArgumentOutOfRangeException(nameof(modelBuilderVersion));
     }
 }
Beispiel #6
0
 public static bool IsEF6OrHigher(this DbModelBuilderVersion modelBuilderVersion)
 {
     if (modelBuilderVersion < DbModelBuilderVersion.V6_0)
     {
         return(modelBuilderVersion == DbModelBuilderVersion.Latest);
     }
     return(true);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DbModelBuilderVersionAttribute" /> class.
        /// </summary>
        /// <param name="version">
        /// The <see cref="DbModelBuilder" /> conventions version to use.
        /// </param>
        public DbModelBuilderVersionAttribute(DbModelBuilderVersion version)
        {
            if (!Enum.IsDefined(typeof(DbModelBuilderVersion), version))
            {
                throw new ArgumentOutOfRangeException("version");
            }

            Version = version;
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="DbModelBuilderVersionAttribute" /> class.
        /// </summary>
        /// <param name="version">
        ///     The <see cref="DbModelBuilder" /> conventions version to use.
        /// </param>
        public DbModelBuilderVersionAttribute(DbModelBuilderVersion version)
        {
            if (!Enum.IsDefined(typeof(DbModelBuilderVersion), version))
            {
                throw new ArgumentOutOfRangeException("version");
            }

            Version = version;
        }
Beispiel #9
0
 public MappingContext(
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration,
     ConventionsConfiguration conventionsConfiguration,
     EdmModel model,
     DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest,
     AttributeProvider attributeProvider       = null)
 {
     this._modelConfiguration       = modelConfiguration;
     this._conventionsConfiguration = conventionsConfiguration;
     this._model = model;
     this._modelBuilderVersion = modelBuilderVersion;
     this._attributeProvider   = attributeProvider ?? new AttributeProvider();
 }
Beispiel #10
0
 private DbModelBuilder(
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration,
     ConventionsConfiguration conventionsConfiguration,
     DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest)
 {
     if (!Enum.IsDefined(typeof(DbModelBuilderVersion), (object)modelBuilderVersion))
     {
         throw new ArgumentOutOfRangeException(nameof(modelBuilderVersion));
     }
     this._modelConfiguration       = modelConfiguration;
     this._conventionsConfiguration = conventionsConfiguration;
     this._modelBuilderVersion      = modelBuilderVersion;
 }
Beispiel #11
0
        private static IEnumerable <IConvention> SelectConventionSet(DbModelBuilderVersion modelBuilderVersion)
        {
            switch (modelBuilderVersion)
            {
            case DbModelBuilderVersion.V4_1:
                return(V1ConventionSet.Conventions);

            case DbModelBuilderVersion.V5_0:
            case DbModelBuilderVersion.Latest:
                return(V2ConventionSet.Conventions);

            default:
                throw new ArgumentOutOfRangeException("modelBuilderVersion");
            }
        }
Beispiel #12
0
        public static double GetEdmVersion(this DbModelBuilderVersion modelBuilderVersion)
        {
            switch (modelBuilderVersion)
            {
            case DbModelBuilderVersion.V4_1:
                return(XmlConstants.EdmVersionForV2);

            case DbModelBuilderVersion.V5_0:
            case DbModelBuilderVersion.Latest:
                return(XmlConstants.EdmVersionForV3);

            default:
                throw new ArgumentOutOfRangeException("modelBuilderVersion");
            }
        }
Beispiel #13
0
        private DbModelBuilder(
            ModelConfiguration.Configuration.ModelConfiguration modelConfiguration,
            ConventionsConfiguration conventionsConfiguration,
            DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest)
        {
            DebugCheck.NotNull(modelConfiguration);
            DebugCheck.NotNull(conventionsConfiguration);
            if (!(Enum.IsDefined(typeof(DbModelBuilderVersion), modelBuilderVersion)))
            {
                throw new ArgumentOutOfRangeException("modelBuilderVersion");
            }

            _modelConfiguration       = modelConfiguration;
            _conventionsConfiguration = conventionsConfiguration;
            _modelBuilderVersion      = modelBuilderVersion;
        }
Beispiel #14
0
        private static ConventionSet SelectConventionSet(DbModelBuilderVersion modelBuilderVersion)
        {
            switch (modelBuilderVersion)
            {
            case DbModelBuilderVersion.V4_1:
                return(V1ConventionSet.Conventions);

            case DbModelBuilderVersion.V5_0_Net4:
            case DbModelBuilderVersion.V5_0:
            case DbModelBuilderVersion.V6_0:
            case DbModelBuilderVersion.Latest:
                return(V2ConventionSet.Conventions);

            default:
                throw new ArgumentOutOfRangeException(nameof(modelBuilderVersion));
            }
        }
Beispiel #15
0
        public static double GetEdmVersion(this DbModelBuilderVersion modelBuilderVersion)
        {
            switch (modelBuilderVersion)
            {
            case DbModelBuilderVersion.Latest:
            case DbModelBuilderVersion.V5_0:
            case DbModelBuilderVersion.V6_0:
                return(3.0);

            case DbModelBuilderVersion.V4_1:
            case DbModelBuilderVersion.V5_0_Net4:
                return(2.0);

            default:
                throw new ArgumentOutOfRangeException(nameof(modelBuilderVersion));
            }
        }
        public MappingContext(
            ModelConfiguration modelConfiguration,
            ConventionsConfiguration conventionsConfiguration,
            EdmModel model,
            DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest,
            AttributeProvider attributeProvider       = null)
        {
            DebugCheck.NotNull(modelConfiguration);
            DebugCheck.NotNull(conventionsConfiguration);
            DebugCheck.NotNull(model);

            _modelConfiguration       = modelConfiguration;
            _conventionsConfiguration = conventionsConfiguration;
            _model = model;
            _modelBuilderVersion = modelBuilderVersion;
            _attributeProvider   = attributeProvider ?? new AttributeProvider();
        }
        public MappingContext(
            ModelConfiguration modelConfiguration,
            ConventionsConfiguration conventionsConfiguration,
            EdmModel model,
            DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest,
            AttributeProvider attributeProvider = null)
        {
            DebugCheck.NotNull(modelConfiguration);
            DebugCheck.NotNull(conventionsConfiguration);
            DebugCheck.NotNull(model);

            _modelConfiguration = modelConfiguration;
            _conventionsConfiguration = conventionsConfiguration;
            _model = model;
            _modelBuilderVersion = modelBuilderVersion;
            _attributeProvider = attributeProvider ?? new AttributeProvider();
        }
 public PropertyFilter(DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest)
 {
     _modelBuilderVersion = modelBuilderVersion;
 }
Beispiel #19
0
 internal DbModelBuilder(
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration,
     DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest)
     : this(modelConfiguration, new ConventionsConfiguration(DbModelBuilder.SelectConventionSet(modelBuilderVersion)), modelBuilderVersion)
 {
 }
 public static bool IsEF6OrHigher(this DbModelBuilderVersion modelBuilderVersion)
 {
     return(modelBuilderVersion >= DbModelBuilderVersion.V6_0 ||
            modelBuilderVersion == DbModelBuilderVersion.Latest);
 }
Beispiel #21
0
 public PropertyFilter(DbModelBuilderVersion modelBuilderVersion = DbModelBuilderVersion.Latest)
 {
     _modelBuilderVersion = modelBuilderVersion;
 }
Beispiel #22
0
 private DbModelBuilder(DbModelBuilder source)
 {
     this._modelConfiguration       = source._modelConfiguration.Clone();
     this._conventionsConfiguration = source._conventionsConfiguration.Clone();
     this._modelBuilderVersion      = source._modelBuilderVersion;
 }