コード例 #1
0
        public static void CreateHighLowTable(NHibernate.Cfg.Configuration config, HiloTable hiloTable)
        {
            StringBuilder stringBuilder1 = new StringBuilder();

            stringBuilder1.AppendFormat("DELETE FROM {0};", (object)hiloTable.Name);
            stringBuilder1.AppendLine();
            stringBuilder1.AppendFormat("ALTER TABLE {0} ADD {1} VARCHAR(128);", (object)hiloTable.Name, (object)hiloTable.TableNameColumn);
            stringBuilder1.AppendLine();
            StringBuilder stringBuilder2 = new StringBuilder();

            foreach (string str in Enumerable.Distinct <string>(Enumerable.Select <PersistentClass, string>(Enumerable.Where <PersistentClass>((IEnumerable <PersistentClass>)config.ClassMappings, (Func <PersistentClass, bool>)(m => m.IdentifierProperty.Type.ReturnedClass == typeof(long))), (Func <PersistentClass, string>)(m => m.Table.Name))))
            {
                stringBuilder2.AppendFormat(string.Format("INSERT INTO [{0}] ({1}, {2}) VALUES ('{3}', 1);", (object)hiloTable.Name, (object)hiloTable.TableNameColumn, (object)hiloTable.NextHiColumn, (object)str), new object[0]);
                stringBuilder2.AppendLine();
            }
            NHibernate.Cfg.Configuration configuration1 = config;
            string sqlCreateString1 = ((object)stringBuilder1).ToString();
            // ISSUE: variable of the null type

            HashedSet <string> hashedSet1 = new HashedSet <string>();

            hashedSet1.Add(typeof(MsSql2005Dialect).FullName);
            hashedSet1.Add(typeof(MsSql2008Dialect).FullName);
            hashedSet1.Add(typeof(MySQL5Dialect).FullName);
            hashedSet1.Add(typeof(SQLiteDialect).FullName);
            HashedSet <string>            dialectScopes1           = hashedSet1;
            SimpleAuxiliaryDatabaseObject auxiliaryDatabaseObject1 = new SimpleAuxiliaryDatabaseObject(sqlCreateString1, (string)"", dialectScopes1);

            configuration1.AddAuxiliaryDatabaseObject((IAuxiliaryDatabaseObject)auxiliaryDatabaseObject1);
            NHibernate.Cfg.Configuration configuration2 = config;
            string sqlCreateString2 = ((object)stringBuilder2).ToString();
            // ISSUE: variable of the null type

            HashedSet <string> hashedSet2 = new HashedSet <string>();

            hashedSet2.Add(typeof(MsSql2005Dialect).FullName);
            hashedSet2.Add(typeof(MsSql2008Dialect).FullName);
            hashedSet2.Add(typeof(MySQL5Dialect).FullName);
            hashedSet2.Add(typeof(SQLiteDialect).FullName);
            HashedSet <string>            dialectScopes2           = hashedSet2;
            SimpleAuxiliaryDatabaseObject auxiliaryDatabaseObject2 = new SimpleAuxiliaryDatabaseObject(sqlCreateString2, (string)"", dialectScopes2);

            configuration2.AddAuxiliaryDatabaseObject((IAuxiliaryDatabaseObject)auxiliaryDatabaseObject2);
        }
コード例 #2
0
        public static void CreateHighLowTable(NHibernate.Cfg.Configuration config, HiloTable hiloTable)
        {
            StringBuilder stringBuilder1 = new StringBuilder();
            stringBuilder1.AppendFormat("DELETE FROM {0};", (object)hiloTable.Name);
            stringBuilder1.AppendLine();
            stringBuilder1.AppendFormat("ALTER TABLE {0} ADD {1} VARCHAR(128);", (object)hiloTable.Name, (object)hiloTable.TableNameColumn);
            stringBuilder1.AppendLine();
            StringBuilder stringBuilder2 = new StringBuilder();
            foreach (string str in Enumerable.Distinct<string>(Enumerable.Select<PersistentClass, string>(Enumerable.Where<PersistentClass>((IEnumerable<PersistentClass>)config.ClassMappings, (Func<PersistentClass, bool>)(m => m.IdentifierProperty.Type.ReturnedClass == typeof(long))), (Func<PersistentClass, string>)(m => m.Table.Name))))
            {
                stringBuilder2.AppendFormat(string.Format("INSERT INTO [{0}] ({1}, {2}) VALUES ('{3}', 1);", (object)hiloTable.Name, (object)hiloTable.TableNameColumn, (object)hiloTable.NextHiColumn, (object)str), new object[0]);
                stringBuilder2.AppendLine();
            }
            NHibernate.Cfg.Configuration configuration1 = config;
            string sqlCreateString1 = ((object)stringBuilder1).ToString();
            // ISSUE: variable of the null type

            HashedSet<string> hashedSet1 = new HashedSet<string>();
            hashedSet1.Add(typeof(MsSql2005Dialect).FullName);
            hashedSet1.Add(typeof(MsSql2008Dialect).FullName);
            hashedSet1.Add(typeof(MySQL5Dialect).FullName);
            hashedSet1.Add(typeof(SQLiteDialect).FullName);
            HashedSet<string> dialectScopes1 = hashedSet1;
            SimpleAuxiliaryDatabaseObject auxiliaryDatabaseObject1 = new SimpleAuxiliaryDatabaseObject(sqlCreateString1, (string)"", dialectScopes1);
            configuration1.AddAuxiliaryDatabaseObject((IAuxiliaryDatabaseObject)auxiliaryDatabaseObject1);
            NHibernate.Cfg.Configuration configuration2 = config;
            string sqlCreateString2 = ((object)stringBuilder2).ToString();
            // ISSUE: variable of the null type

            HashedSet<string> hashedSet2 = new HashedSet<string>();
            hashedSet2.Add(typeof(MsSql2005Dialect).FullName);
            hashedSet2.Add(typeof(MsSql2008Dialect).FullName);
            hashedSet2.Add(typeof(MySQL5Dialect).FullName);
            hashedSet2.Add(typeof(SQLiteDialect).FullName);
            HashedSet<string> dialectScopes2 = hashedSet2;
            SimpleAuxiliaryDatabaseObject auxiliaryDatabaseObject2 = new SimpleAuxiliaryDatabaseObject(sqlCreateString2, (string)"", dialectScopes2);
            configuration2.AddAuxiliaryDatabaseObject((IAuxiliaryDatabaseObject)auxiliaryDatabaseObject2);
        }