本文整理汇总了C#中NHibernate.Mapping.Column类的典型用法代码示例。如果您正苦于以下问题:C# Column类的具体用法?C# Column怎么用?C# Column使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Column类属于NHibernate.Mapping命名空间,在下文中一共展示了Column类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Bug
public void Bug()
{
Table table1 = new Table("ATABLE");
Column table1ITestManyA = new Column("itestmanyaid");
Column table1ITestManyB = new Column("itestmanybid");
string t1Fk = table1.UniqueColumnString(new object[] { table1ITestManyA }, "BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyA");
string t2Fk = table1.UniqueColumnString(new object[] { table1ITestManyB }, "BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyB");
Assert.AreNotEqual(t1Fk, t2Fk, "Different columns in differents tables create the same FK name.");
}
开发者ID:owerkop,项目名称:nhibernate-core,代码行数:10,代码来源:Fixture.cs
示例17: ColumnInfo
/// <summary>
/// Constructor.
/// </summary>
/// <param name="column"></param>
/// <param name="config"></param>
/// <param name="dialect"></param>
internal ColumnInfo(Column column, Configuration config, Dialect dialect)
{
_name = column.Name;
_nullable = column.IsNullable;
_sqlType = column.GetSqlType(dialect, new Mapping(config));
//as of NH2.0, the length column seems to be set at 255 for non-string-like columns, which makes no sense
//therefore ignore NH length for non-string like columns, and use -1 which corresponds to the pre-2.0 behaviour
_length = (this.SqlType.IndexOf("char", System.StringComparison.InvariantCultureIgnoreCase) > -1) ? column.Length : -1;
}
开发者ID:nhannd,项目名称:Xian,代码行数:16,代码来源:ColumnInfo.cs
示例18: BindColumn
protected static void BindColumn(HbmColumn columnSchema, Column column, bool isNullable)
{
if (columnSchema.length != null)
column.Length = int.Parse(columnSchema.length);
column.IsNullable = columnSchema.notnullSpecified ? !columnSchema.notnull : isNullable;
column.IsUnique = columnSchema.uniqueSpecified && columnSchema.unique;
column.CheckConstraint = columnSchema.check ?? string.Empty;
column.SqlType = columnSchema.sqltype;
}
开发者ID:aistrate,项目名称:TypingPracticeTexts,代码行数:10,代码来源:ClassBinder.cs
示例19: AddColumn
public virtual void AddColumn(Column column)
{
if (!columns.Contains(column))
{
columns.Add(column);
}
// TODO H3:
// column.Value = this;
// column.TypeIndex = columns.Count - 1;
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:11,代码来源:SimpleValue.cs
示例20: StringSqlType
public void StringSqlType()
{
SimpleValue sv = new SimpleValue();
sv.TypeName = NHibernateUtil.String.Name;
Column column = new Column();
column.Value = sv;
Assert.AreEqual("NVARCHAR(255)", column.GetSqlType(_dialect, null));
column.Length = 100;
Assert.AreEqual("NVARCHAR(100)", column.GetSqlType(_dialect, null));
}
开发者ID:tkellogg,项目名称:NHibernate3-withProxyHooks,代码行数:11,代码来源:ColumnFixture.cs
注:本文中的NHibernate.Mapping.Column类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论