當前位置: 首頁>>代碼示例>>C#>>正文


C# Mapping.Column類代碼示例

本文整理匯總了C#中NHibernate.Mapping.Column的典型用法代碼示例。如果您正苦於以下問題:C# Column類的具體用法?C# Column怎麽用?C# Column使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Column類屬於NHibernate.Mapping命名空間,在下文中一共展示了Column類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MigrationColumn

 public MigrationColumn(Column column, MigrationColumnType type)
 {
     Name = column.Name;
     IsNullable = column.IsNullable;
     Type = type;
     IsPrimaryKey = false;
 }
開發者ID:kingatlas,項目名稱:NHibernate.AutoMigration,代碼行數:7,代碼來源:MigrationColumn.cs

示例2: UnmatchingColumns

		public void UnmatchingColumns()
		{
			Table primaryTable = new Table("pktable");
			primaryTable.PrimaryKey = new PrimaryKey();
			SimpleValue sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.Int16.Name;
			Column pkColumn = new Column("pk_column");
			pkColumn.Value = sv;

			primaryTable.PrimaryKey.AddColumn(pkColumn);

			Table fkTable = new Table("fktable");

			ForeignKey fk = new ForeignKey();
			sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.Int16.Name;
			Column fkColumn1 = new Column("col1");
			fkColumn1.Value = sv;

			sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.Int16.Name;
			Column fkColumn2 = new Column("col2");
			fkColumn2.Value = sv;

			fk.AddColumn(fkColumn1);
			fk.AddColumn(fkColumn2);

			fk.Table = fkTable;

			fk.ReferencedTable = primaryTable;
			Assert.Throws<FKUnmatchingColumnsException>(() => fk.AlignColumns());
		}
開發者ID:NikGovorov,項目名稱:nhibernate-core,代碼行數:32,代碼來源:ForeignKeyFixture.cs

示例3: SelectMigrationColumn

        private MigrationColumn SelectMigrationColumn(Column column)
        {
            if (column.Value.Type.ReturnedClass == typeof(Guid))
                return new GuidMigrationColumn(column);

            if (column.Value.Type.ReturnedClass == typeof(decimal))
                return new DecimalMigrationColumn(column);

            if (column.Value.Type.ReturnedClass == typeof(string))
                return new StringMigrationColumn(column);

            if (column.Value.Type.ReturnedClass == typeof(DateTime))
                return new DateTimeMigrationColumn(column);

            if (column.Value.Type.ReturnedClass == typeof(bool))
                return new BoolMigrationColumn(column);

            if (column.Value.Type.ReturnedClass == typeof(short))
                return new ShortMigrationColumn(column);

            //TODO Blob

            // if (column.Value.Type.ReturnedClass.IsEnum || column.Value.Type.ReturnedClass == typeof(int))
            return new IntegerMigrationColumn(column);
        }
開發者ID:kingatlas,項目名稱:NHibernate.AutoMigration,代碼行數:25,代碼來源:MigrationColumnFactory.cs

示例4: BindColumn

 private static void BindColumn(Column column, bool isNullable)
 {
     column.IsNullable = isNullable;
     column.IsUnique = false;
     column.CheckConstraint = string.Empty;
     column.SqlType = null;
 }
開發者ID:zibler,項目名稱:zibler,代碼行數:7,代碼來源:RootClassBinder.cs

示例5: AddColumn

		/// <summary>
		/// 
		/// </summary>
		/// <param name="column"></param>
		public virtual void AddColumn( Column column )
		{
			if( !columns.Contains( column ) )
			{
				columns.Add( column );
			}
		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:11,代碼來源:SimpleValue.cs

示例6: UnmatchingColumns

		public void UnmatchingColumns()
		{

			Table primaryTable = new Table();
			primaryTable.Name = "pktable";
			primaryTable.PrimaryKey = new PrimaryKey();
			Column pkColumn = new Column( NHibernateUtil.Int16, 0 );
			pkColumn.Name = "pk_column";

			primaryTable.PrimaryKey.AddColumn( pkColumn );

			Table fkTable = new Table();
			fkTable.Name = "fktable";

			ForeignKey fk = new ForeignKey();
			Column fkColumn1 = new Column( NHibernateUtil.Int16, 0 );
			fkColumn1.Name = "col1";

			Column fkColumn2 = new Column( NHibernateUtil.Int16, 0 );
			fkColumn2.Name = "col2";

			fk.AddColumn( fkColumn1 );
			fk.AddColumn( fkColumn2 );
			
			fk.Table = fkTable;

			fk.ReferencedTable = primaryTable;

		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:29,代碼來源:ForeignKeyFixture.cs

示例7: BindColumn

 private static void BindColumn(Column model, bool isNullable)
 {
     model.IsNullable = isNullable;
     model.IsUnique = false;
     model.CheckConstraint = string.Empty;
     model.SqlType = null;
 }
開發者ID:zibler,項目名稱:zibler,代碼行數:7,代碼來源:ClassCompositeIdBinder.cs

示例8: remapGetDateDefaultValues

		static void remapGetDateDefaultValues(Column column)
		{
			if (string.Compare(column.SqlType, "datetime", StringComparison.OrdinalIgnoreCase) != 0 &&
				string.Compare(column.DefaultValue, "getdate()", StringComparison.OrdinalIgnoreCase) != 0)
				return;

			column.DefaultValue = "CURRENT_TIMESTAMP";
		}
開發者ID:seatwave,項目名稱:Quarks,代碼行數:8,代碼來源:SqliteRemapper.cs

示例9: BindIndex

		private static void BindIndex(string indexAttribute, Table table, Column column)
		{
			if (indexAttribute != null && table != null)
			{
				var tokens = indexAttribute.Split(',');
				System.Array.ForEach(tokens, t => table.GetOrCreateIndex(t.Trim()).AddColumn(column));
			}
		}
開發者ID:jlevitt,項目名稱:nhibernate-core,代碼行數:8,代碼來源:ColumnsBinder.cs

示例10: BindUniqueKey

		private static void BindUniqueKey(string uniqueKeyAttribute, Table table, Column column)
		{
			if (uniqueKeyAttribute != null && table != null)
			{
				var tokens = uniqueKeyAttribute.Split(',');
				System.Array.ForEach(tokens, t => table.GetOrCreateUniqueKey(t.Trim()).AddColumn(column));
			}
		}
開發者ID:jlevitt,項目名稱:nhibernate-core,代碼行數:8,代碼來源:ColumnsBinder.cs

示例11: Create

        public MigrationColumn Create(Column column)
        {

            var result = SelectMigrationColumn(column);
            result.OwnerTable = OwnerTable;

            return result;
        }
開發者ID:kingatlas,項目名稱:NHibernate.AutoMigration,代碼行數:8,代碼來源:MigrationColumnFactory.cs

示例12: YesNoSqlType

		public void YesNoSqlType()
		{
			SimpleValue sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.YesNo.Name;
			Column column = new Column();
			column.Value = sv;
			string type = column.GetSqlType(_dialect, null);
			Assert.AreEqual("CHAR(1)", type);
		}
開發者ID:tkellogg,項目名稱:NHibernate3-withProxyHooks,代碼行數:9,代碼來源:ColumnFixture.cs

示例13: BindIndex

 protected static void BindIndex(string indexAttribute, Table table, Column column)
 {
     if (indexAttribute != null && table != null)
     {
         StringTokenizer tokens = new StringTokenizer(indexAttribute, ", ");
         foreach (string token in tokens)
             table.GetOrCreateIndex(token).AddColumn(column);
     }
 }
開發者ID:aistrate,項目名稱:TypingPracticeTexts,代碼行數:9,代碼來源:ClassBinder.cs

示例14: StringSqlType

		public void StringSqlType()
		{
			Column column = new Column(NHibernateUtil.String, 0);
			Assert.AreEqual("NVARCHAR(255)", column.GetSqlType(_dialect, null));

			column.Length = 100;
			Assert.AreEqual("NVARCHAR(100)", column.GetSqlType(_dialect, null));

		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:9,代碼來源:ColumnFixture.cs

示例15: BindColumn

        private static void BindColumn(HbmDiscriminator discriminatorSchema, Column column)
        {
            if (discriminatorSchema.length != null)
                column.Length = int.Parse(discriminatorSchema.length);

            column.IsNullable = !discriminatorSchema.notnull;
            column.IsUnique = false;
            column.CheckConstraint = string.Empty;
            column.SqlType = null;
        }
開發者ID:zibler,項目名稱:zibler,代碼行數:10,代碼來源:ClassDiscriminatorBinder.cs


注:本文中的NHibernate.Mapping.Column類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。