예제 #1
0
        private static bool IsTableNameEqual(EntityType table, DatabaseName otherTableName)
        {
            var tableName = table.GetTableName();

            if (tableName != null)
            {
                return(otherTableName.Equals(tableName));
            }
            else
            {
                return(otherTableName.Name.Equals(table.Name, StringComparison.Ordinal) && otherTableName.Schema == null);
            }
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            DatabaseInfo dest = (DatabaseInfo)obj;

            if (this.DatabaseName == null || dest.DatabaseName == null)
            {
                return(this.DatabaseName == null && dest.DatabaseName == null);
            }

            return(DatabaseName.Equals(dest.DatabaseName, StringComparison.CurrentCultureIgnoreCase));
        }
예제 #3
0
        public static System.Data.Entity.Core.Metadata.Edm.EntityType FindTableByName(
            this EdmModel database,
            DatabaseName tableName)
        {
            IList <System.Data.Entity.Core.Metadata.Edm.EntityType> entityTypeList = database.EntityTypes as IList <System.Data.Entity.Core.Metadata.Edm.EntityType> ?? (IList <System.Data.Entity.Core.Metadata.Edm.EntityType>)database.EntityTypes.ToList <System.Data.Entity.Core.Metadata.Edm.EntityType>();

            for (int index = 0; index < entityTypeList.Count; ++index)
            {
                System.Data.Entity.Core.Metadata.Edm.EntityType table = entityTypeList[index];
                DatabaseName tableName1 = table.GetTableName();
                if ((tableName1 != null ? (tableName1.Equals(tableName) ? 1 : 0) : (!string.Equals(table.Name, tableName.Name, StringComparison.Ordinal) ? 0 : (tableName.Schema == null ? 1 : 0))) != 0)
                {
                    return(table);
                }
            }
            return((System.Data.Entity.Core.Metadata.Edm.EntityType)null);
        }
예제 #4
0
 public bool IsSettingForDatabase(DatabaseSetting db)
 {
     if (db == null)
     {
         return(false);
     }
     if (!ServerName.Equals(db.ServerName, StringComparison.InvariantCultureIgnoreCase))
     {
         return(false);
     }
     if (!DatabaseName.Equals(db.DatabaseName, StringComparison.InvariantCultureIgnoreCase))
     {
         return(false);
     }
     if (!ConnectionString.Equals(db.ConnectionString, StringComparison.InvariantCultureIgnoreCase))
     {
         return(false);
     }
     if (!ConnectionString.Equals(db.ConnectionString, StringComparison.InvariantCultureIgnoreCase))
     {
         return(false);
     }
     return((new DirectoryInfo(ScriptsPath)).FullName.Equals((new DirectoryInfo(db.ScriptsPath)).FullName, StringComparison.InvariantCultureIgnoreCase));
 }
예제 #5
0
        internal void AddMappingConfiguration(
            EntityMappingConfiguration mappingConfiguration,
            bool cloneable = true)
        {
            if (this._entityMappingConfigurations.Contains(mappingConfiguration))
            {
                return;
            }
            DatabaseName tableName = mappingConfiguration.TableName;

            if (tableName != null && this._entityMappingConfigurations.SingleOrDefault <EntityMappingConfiguration>((Func <EntityMappingConfiguration, bool>)(mf => tableName.Equals(mf.TableName))) != null)
            {
                throw Error.InvalidTableMapping((object)this.ClrType.Name, (object)tableName);
            }
            this._entityMappingConfigurations.Add(mappingConfiguration);
            if (this._entityMappingConfigurations.Count > 1 && this._entityMappingConfigurations.Any <EntityMappingConfiguration>((Func <EntityMappingConfiguration, bool>)(mc => mc.TableName == null)))
            {
                throw Error.InvalidTableMapping_NoTableName((object)this.ClrType.Name);
            }
            this.IsTableNameConfigured |= tableName != null;
            if (cloneable)
            {
                return;
            }
            this._nonCloneableMappings.Add(mappingConfiguration);
        }