本文整理汇总了C#中System.Data.Entity.Migrations.Model.ColumnModel类的典型用法代码示例。如果您正苦于以下问题:C# ColumnModel类的具体用法?C# ColumnModel怎么用?C# ColumnModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnModel类属于System.Data.Entity.Migrations.Model命名空间,在下文中一共展示了ColumnModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IsNarrowerThan_should_return_true_when_max_length_narrower
public void IsNarrowerThan_should_return_true_when_max_length_narrower()
{
var columnModel1 = new ColumnModel(PrimitiveTypeKind.String)
{
MaxLength = 1
};
var columnModel2 = new ColumnModel(PrimitiveTypeKind.String)
{
MaxLength = 2
};
Assert.True(columnModel1.IsNarrowerThan(columnModel2, _providerManifest));
columnModel1 = new ColumnModel(PrimitiveTypeKind.String)
{
MaxLength = 1
};
columnModel2 = new ColumnModel(PrimitiveTypeKind.String);
Assert.True(columnModel1.IsNarrowerThan(columnModel2, _providerManifest));
columnModel1 = new ColumnModel(PrimitiveTypeKind.String);
columnModel2 = new ColumnModel(PrimitiveTypeKind.String)
{
MaxLength = 1
};
Assert.False(columnModel1.IsNarrowerThan(columnModel2, _providerManifest));
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:29,代码来源:ColumnModelTests.cs示例2: AddDefaultValue
private static void AddDefaultValue(ColumnModel Column)
{
if (Column.Annotations.Any(o => o.Key == "DefaultValue"))
{
Column.DefaultValueSql = Column.Annotations["DefaultValue"].NewValue.ToString();
}
}
开发者ID:Infro-CommonLibrary,项目名称:CommonCSharp,代码行数:7,代码来源:ExtendedSqlServerMigrationSqlGenerator.cs示例3: Can_get_and_set_column_properties
public void Can_get_and_set_column_properties()
{
var column = new ColumnModel(PrimitiveTypeKind.Guid)
{
Name = "C",
IsNullable = true,
IsIdentity = true,
IsFixedLength = true,
IsUnicode = true,
MaxLength = 42,
Precision = 23,
Scale = 1,
StoreType = "foobar"
};
Assert.Equal("C", column.Name);
Assert.Equal(PrimitiveTypeKind.Guid, column.Type);
Assert.True(column.IsNullable.Value);
Assert.True(column.IsIdentity);
Assert.True(column.IsFixedLength.Value);
Assert.True(column.IsUnicode.Value);
Assert.Equal(42, column.MaxLength);
Assert.Equal((byte)23, column.Precision);
Assert.Equal((byte)1, column.Scale);
Assert.Equal("foobar", column.StoreType);
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:26,代码来源:ColumnModelTests.cs示例4: IsNarrowerThan_should_return_true_when_nullable_narrower
public void IsNarrowerThan_should_return_true_when_nullable_narrower()
{
var columnModel1 = new ColumnModel(PrimitiveTypeKind.String)
{
IsNullable = false
};
var columnModel2 = new ColumnModel(PrimitiveTypeKind.String)
{
IsNullable = true
};
Assert.True(columnModel1.IsNarrowerThan(columnModel2, _providerManifest));
columnModel1 = new ColumnModel(PrimitiveTypeKind.String)
{
IsNullable = false
};
columnModel2 = new ColumnModel(PrimitiveTypeKind.String);
Assert.True(columnModel1.IsNarrowerThan(columnModel2, _providerManifest));
columnModel1 = new ColumnModel(PrimitiveTypeKind.String);
columnModel2 = new ColumnModel(PrimitiveTypeKind.String)
{
IsNullable = false
};
Assert.False(columnModel1.IsNarrowerThan(columnModel2, _providerManifest));
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:29,代码来源:ColumnModelTests.cs示例5: Inverse_should_produce_change_column_operation
public void Inverse_should_produce_change_column_operation()
{
var column = new ColumnModel(PrimitiveTypeKind.Boolean);
var inverse = new AlterColumnOperation("T", column, isDestructiveChange: false);
var alterColumnOperation = new AlterColumnOperation("T", column, isDestructiveChange: false, inverse: inverse);
Assert.Same(inverse, alterColumnOperation.Inverse);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:AlterColumnOperationTests.cs示例6: Can_get_and_set_table_and_column_info
public void Can_get_and_set_table_and_column_info()
{
var column = new ColumnModel(PrimitiveTypeKind.Boolean);
var alterColumnOperation = new AlterColumnOperation("T", column, isDestructiveChange: false);
Assert.Equal("T", alterColumnOperation.Table);
Assert.Same(column, alterColumnOperation.Column);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:AlterColumnOperationTests.cs示例7: Can_get_and_set_table_and_column_info
public void Can_get_and_set_table_and_column_info()
{
var column = new ColumnModel(PrimitiveTypeKind.Decimal);
var addColumnOperation = new AddColumnOperation("T", column);
Assert.Equal("T", addColumnOperation.Table);
Assert.Same(column, addColumnOperation.Column);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:AddColumnOperationTests.cs示例8: AddColumnOperation
public AddColumnOperation(string table, ColumnModel column, object anonymousArguments = null)
: base(anonymousArguments)
{
//Contract.Requires(!string.IsNullOrWhiteSpace(table));
//Contract.Requires(column != null);
_table = table;
_column = column;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:9,代码来源:AddColumnOperation.cs示例9: AddColumnOperation
public AddColumnOperation(string table, ColumnModel column, object anonymousArguments = null)
: base(anonymousArguments)
{
Check.NotEmpty(table, "table");
Check.NotNull(column, "column");
_table = table;
_column = column;
}
开发者ID:jwanagel,项目名称:jjwtest,代码行数:9,代码来源:AddColumnOperation.cs示例10: AlterColumnOperation
public AlterColumnOperation(
string table, ColumnModel column, bool isDestructiveChange, AlterColumnOperation inverse,
object anonymousArguments = null)
: this(table, column, isDestructiveChange, anonymousArguments)
{
Check.NotNull(inverse, "inverse");
_inverse = inverse;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:9,代码来源:AlterColumnOperation.cs示例11: AlterColumnOperation
public AlterColumnOperation(
string table, ColumnModel column, bool isDestructiveChange, AlterColumnOperation inverse,
object anonymousArguments = null)
: this(table, column, isDestructiveChange, anonymousArguments)
{
//Contract.Requires(inverse != null);
_inverse = inverse;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:9,代码来源:AlterColumnOperation.cs示例12: Inverse_should_produce_drop_column_operation
public void Inverse_should_produce_drop_column_operation()
{
var column = new ColumnModel(PrimitiveTypeKind.Decimal) { Name = "C" };
var addColumnOperation = new AddColumnOperation("T", column);
var dropColumnOperation = (DropColumnOperation)addColumnOperation.Inverse;
Assert.Equal("C", dropColumnOperation.Name);
Assert.Equal("T", dropColumnOperation.Table);
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:10,代码来源:AddColumnOperationTests.cs示例13: BuildColumnType
protected override string BuildColumnType(ColumnModel columnModel)
{
if (columnModel == null)
{
throw new ArgumentNullException("columnModel");
}
TableColumnType tableColumnType = this.GetTableColumnType(columnModel);
if (tableColumnType != TableColumnType.None)
{
this.UpdateTableColumn(columnModel, tableColumnType);
}
return base.BuildColumnType(columnModel);
}
开发者ID:RossMerr,项目名称:azure-mobile-apps-net-server,代码行数:15,代码来源:EntityTableSqlGenerator.cs示例14: GenerateCanOutputAddColumnStatementWhenNonNullableAndNoDefaultProvided
public void GenerateCanOutputAddColumnStatementWhenNonNullableAndNoDefaultProvided()
{
var migrationSqlGenerator = new PostgreSqlMigrationSqlGenerator();
var column = new ColumnModel(PrimitiveTypeKind.Int32)
{
Name = "Bar",
IsNullable = false
};
var addColumnOperation = new AddColumnOperation("Foo", column);
var sql = migrationSqlGenerator.Generate(new[] { addColumnOperation }, "9.2").Join(s => s.Sql, Environment.NewLine);
Assert.True(sql.Contains("ALTER TABLE \"Foo\" ADD \"Bar\" integer NOT NULL DEFAULT 0"));
}
开发者ID:darionato,项目名称:PostgreSqlMigrationSqlGenerator,代码行数:15,代码来源:PostgreSqlMigrationSqlGeneretorTest.cs示例15: Can_get_and_set_annotations
public void Can_get_and_set_annotations()
{
var column = new ColumnModel(PrimitiveTypeKind.Guid);
Assert.Empty(column.Annotations);
column.Annotations = new Dictionary<string, AnnotationValues> { { "A1", new AnnotationValues("V1", "V2") } };
Assert.Equal("V1", column.Annotations["A1"].OldValue);
Assert.Equal("V2", column.Annotations["A1"].NewValue);
column.Annotations = null;
Assert.Empty(column.Annotations);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:15,代码来源:ColumnModelTests.cs本文标签属性:
示例:示例志愿表
代码:代码是什么
ColumnModel:ColumnModel
Model:model 3