本文整理汇总了C#中Column类的典型用法代码示例。如果您正苦于以下问题:C# Column类的具体用法?C# Column怎么用?C# Column使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Column类属于命名空间,在下文中一共展示了Column类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GenerateCore
protected override object GenerateCore(Project project, Column column)
{
var gender = Gender;
if (gender == Gender.Unknown)
{
var columnGender = project.CurrentRow.GetValue(WellKnownDataType.Gender) as string;
if (columnGender != null)
{
if (string.Equals(columnGender, "Mr", StringComparison.OrdinalIgnoreCase) ||
string.Equals(columnGender, "M", StringComparison.OrdinalIgnoreCase) ||
string.Equals(columnGender, "M.", StringComparison.OrdinalIgnoreCase))
{
gender = Gender.Male;
}
else
{
gender = Gender.Female;
}
}
}
switch (gender)
{
case Gender.Male:
return StringGenerator.CoerceValue(Random.NextFromList(ReferentialData.MaleFirstNames), column);
case Gender.Female:
return StringGenerator.CoerceValue(Random.NextFromList(ReferentialData.FemaleFirstNames), column);
default:
return StringGenerator.CoerceValue(Random.NextFromList(ReferentialData.FirstNames), column);
}
}
开发者ID:meziantou,项目名称:Meziantou.DataGenerator,代码行数:31,代码来源:FirstNameGenerator.cs
示例2: GetColumns
private Columns GetColumns(string connectionString, string sqlCmd)
{
Columns columns = new Columns(50);
MySqlDataReader dr = MySqlHelper.ExecuteReader(connectionString, sqlCmd);
while (dr.Read())
{
string id = dr.IsDBNull(2) ? string.Empty : dr.GetString(2);
string displayName = dr.IsDBNull(2) ? string.Empty : dr.GetString(2);
string name = dr.IsDBNull(2) ? string.Empty : dr.GetString(2);
string dataType = dr.IsDBNull(3) ? string.Empty : dr.GetString(3);
string key = dr.IsDBNull(4) ? string.Empty : dr.GetString(4);
string defaultValue = dr.IsDBNull(5) ? string.Empty : dr.GetString(5);
string isNullable = dr.IsDBNull(6) ? string.Empty : dr.GetString(6);
string length = dr.IsDBNull(7) ? string.Empty : dr.GetString(7);
string identity = dr.IsDBNull(8) ? string.Empty : dr.GetString(8);
string comment = dr.IsDBNull(9) ? string.Empty : dr.GetString(9);
Column column = new Column(id, displayName, name, dataType, comment);
column.Length = ConvertHelper.GetInt32(length);
column.IsAutoIncremented = identity.Equals("auto_increment");
column.IsNullable = isNullable.Equals("YES");
column.DefaultValue = defaultValue.ToEmpty();
column.DataType = dataType;
column.OriginalName = name;
columns.Add(id, column);
}
dr.Close();
return columns;
}
开发者ID:xianrendzw,项目名称:CodeBuilder,代码行数:30,代码来源:MySql5Exporter.cs
示例3: GetColumns
private Columns GetColumns(string connectionString, string sqlCmd)
{
Columns columns = new Columns(50);
SqlDataReader dr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, sqlCmd);
while (dr.Read())
{
string id = dr.IsDBNull(2) ? string.Empty : dr.GetString(2);
string displayName = dr.IsDBNull(2) ? string.Empty : dr.GetString(2);
string name = dr.IsDBNull(2) ? string.Empty : dr.GetString(2);
int length = dr.IsDBNull(3) ? 0 : dr.GetInt16(3);
bool identity = dr.IsDBNull(4) ? false : dr.GetBoolean(4);
bool isNullable = dr.IsDBNull(5) ? false : dr.GetBoolean(5);
bool isComputed = dr.IsDBNull(6) ? false : dr.GetBoolean(6);
string dataType = dr.IsDBNull(7) ? string.Empty : dr.GetString(7);
string comment = dr.IsDBNull(8) ? string.Empty : dr.GetString(8);
string defaultValue = dr.IsDBNull(9) ? string.Empty : dr.GetString(9);
Column column = new Column(id, displayName, name, dataType, comment);
column.Length = length;
column.IsAutoIncremented = identity;
column.IsNullable = isNullable;
column.DefaultValue = defaultValue;
column.DataType = dataType;
column.OriginalName = name;
column.IsComputed = isComputed;
columns.Add(id, column);
}
dr.Close();
return columns;
}
开发者ID:xianrendzw,项目名称:CodeBuilder,代码行数:31,代码来源:SqlServer2005Exporter.cs
示例4: GetColumns
public virtual Column[] GetColumns(string table) {
List<Column> columns = new List<Column>();
using (
IDataReader reader =
ExecuteQuery(
String.Format(
"select COLUMN_NAME, IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'",
table))) {
while (reader.Read()) {
Column column = new Column(reader.GetString(0), DbType.String);
string nullableStr = reader.GetString(1);
bool isNullable = nullableStr == "YES";
column.ColumnProperty |= isNullable ? ColumnProperty.Null : ColumnProperty.NotNull;
var typeString = reader.GetString(2);
if (reader.IsDBNull(3) == false) {
var length = reader.GetInt32(3);
if (length == -1) {
typeString += "(MAX)";
}
else {
typeString += "(" + length + ")";
}
}
column.TypeString = typeString;
columns.Add(column);
}
}
return columns.ToArray();
}
开发者ID:chrisortman,项目名称:Ketchup.EntityFramework,代码行数:32,代码来源:TransformationProvider.cs
示例5: CrossTabResults
public CrossTabResults(List<Column> groupByColumns, Column crossTabColumn, List<Column> summarizeColumns, List<string> crossTabColumnVaues)
{
_groupByColumns = groupByColumns;
_crossTabColumn = crossTabColumn;
_summarizeColumns = summarizeColumns;
_crossTabColumnVaues = crossTabColumnVaues;
}
开发者ID:mukeshdepani,项目名称:ParaRD,代码行数:7,代码来源:CrossTabResults.cs
示例6: CopyTo
public override Column CopyTo(Column column)
{
var textColumn = (TextColumn)column;
textColumn.CharLength = CharLength;
textColumn.ByteLength = ByteLength;
return base.CopyTo(textColumn);
}
开发者ID:GrgDmr,项目名称:CDAManager,代码行数:7,代码来源:TextColumn.cs
示例7: TableJoin
public TableJoin(Table master, Column masterColumn, Table detail, Column detailColumn)
{
_master = master;
_masterColumn = masterColumn;
_detailColumn = detailColumn;
_detail = detail;
}
开发者ID:JorgeGamba,项目名称:Simple.Data,代码行数:7,代码来源:TableJoin.cs
示例8: AddColumn
public ActionResult AddColumn()
{
Store store = this.GetCmp<Store>("Store1");
Ext.Net.GridPanel grid = this.GetCmp<Ext.Net.GridPanel>("GridPanel1");
ModelField field = new ModelField("pctChange", ModelFieldType.Float);
store.AddField(field, 3);
store.LoadData(Companies.GetAllCompanies());
Column col = new Column();
col.ID = "pctChangeColumn";
col.Text = "Change %";
col.Width = 75;
col.Sortable = true;
col.DataIndex = "pctChange";
col.Renderer.Fn = "pctChange";
ComboBox cb = new ComboBox() { ID = "ComboBox1" };
cb.Items.Add(new Ext.Net.ListItem("1", "1"));
cb.Items.Add(new Ext.Net.ListItem("2", "2"));
cb.Items.Add(new Ext.Net.ListItem("3", "3"));
col.Editor.Add(cb);
grid.AddColumn(col);
return this.Direct();
}
开发者ID:shalves,项目名称:Ext.NET.Community,代码行数:30,代码来源:Ajax_ConfigurationController.cs
示例9: GenerateCore
protected override object GenerateCore(Project project, Column column)
{
IList<string> formats = new[]
{
"{0}.{2}@{5}.{6}", // [email protected]
"{1}.{2}@{5}.{6}", // FirstName[0][email protected]
"{3}@{5}.{6}", // [email protected]
"{2}.{0}@{5}.{6}", // [email protected]
"{2}.{1}@{5}.{6}", // LastName.FirstName[0]@Domain
"{4}@{5}.{6}" // [email protected]
};
for (int i = 0; i < 10; i++)
{
string firstName = project.CurrentRow.GetValue(WellKnownDataType.FirstName) as string ?? Random.NextFromList(ReferentialData.FirstNames);
string lastName = project.CurrentRow.GetValue(WellKnownDataType.LastName) as string ?? Random.NextFromList(ReferentialData.LastNames);
string domain = Random.NextFromList(ReferentialData.EmailDomainsWithoutLld);
string tld = Random.NextFromList(ReferentialData.TopLevelDomains);
string username = project.CurrentRow.GetValue(WellKnownDataType.UserName) as string ??_userNameGenerator.Generate(project, column, 1, 0).Cast<string>().First();
string format = Random.NextFromList(formats);
string email = string.Format(format, firstName, firstName[0], lastName, lastName[0], username, domain, tld);
if (IsValid(email))
return email;
}
return null;
}
开发者ID:meziantou,项目名称:Meziantou.DataGenerator,代码行数:29,代码来源:EmailGenerator.cs
示例10: MemberGraph
public MemberGraph(Column sqlColumn)
{
this.SqlColumn = sqlColumn;
this.Name = SqlColumn.Name;
this.GraphType = TypeConvertor.ToNetType(sqlColumn.DataType.SqlDataType);
this.IsReadOnly = false;
if (sqlColumn.Computed)
{
this.IsReadOnly = true;
}
if (sqlColumn.Parent.IsView())
{
this.IsReadOnly = true;
}
if (TypeConvertor.NullabeTypes().Contains(this.GraphType))
{
this.IsNullable = true;
}
else
{
this.IsNullable = false;
}
if (this.SqlColumn.Nullable)
{
this.Required = false;
}
else
{
this.Required = true;
}
}
开发者ID:rexwhitten,项目名称:MGenerator,代码行数:35,代码来源:MemberGraph.cs
示例11: CanGenerate
public override bool CanGenerate(Column column)
{
if (IsGeneratedColumn(column) || IsForeginKey(column))
return false;
return IsNumericDbType(column.CodeFluentType.DbType);
}
开发者ID:meziantou,项目名称:Meziantou.DataGenerator,代码行数:7,代码来源:NumberGenerator.cs
示例12: CheckSchemaInfoTable
public void CheckSchemaInfoTable()
{
if (_schemaProvider.HasTable(TableName))
{
if (!_schemaProvider.HasColumn(TableName, ScopeColumnName))
{
_log.InfoFormat("Adding {0} column to {1}...", ScopeColumnName, TableName);
_schemaProvider.AddColumn(TableName, ScopeColumnName, typeof(string), 25, false, true);
}
if (!_schemaProvider.IsColumnOfType(TableName, VersionColumnName, VersionColumnType))
{
_log.InfoFormat("Changing {0} column to {1}...", VersionColumnName, VersionColumnType);
_schemaProvider.ChangeColumn(TableName, VersionColumnName, typeof(Int64), 8, false);
}
return;
}
_log.InfoFormat("Creating {0}...", TableName);
Column[] columns = new Column[]
{
new Column(IdColumnName, typeof(Int32), 4, true),
new Column(VersionColumnName, typeof(Int64), 8, false),
new Column(ScopeColumnName, typeof(string), 25, false, true)
};
_schemaProvider.AddTable(TableName, columns);
}
开发者ID:emmekappa,项目名称:machine.migrations,代码行数:29,代码来源:AbstractSchemaStateManager.cs
示例13: TableMapping
public TableMapping(Type type)
{
this.MappedType = type;
this.TableName = this.MappedType.Name;
var props = this.MappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
var cols = new List<Column>();
foreach (var p in props)
{
var ignore = p.GetCustomAttributes(typeof(IgnoreAttribute), true).Length > 0;
if (p.CanWrite && !ignore)
{
cols.Add(new PropColumn(p));
}
}
this.Columns = cols.ToArray();
foreach (var c in this.Columns)
{
if (c.IsAutoInc && c.IsPK)
{
this._autoPk = c;
}
if (c.IsPK)
{
this.PK = c;
}
}
this.HasAutoIncPK = this._autoPk != null;
}
开发者ID:flozi76,项目名称:TimeTracker,代码行数:29,代码来源:TableMapping.cs
示例14: CreateAddColumnStatement
public static Statement CreateAddColumnStatement(string tableName, Column column)
{
var writer = new SqlWriter();
writer.Alter.Table.QuotedName(tableName).Add.Flush();
WriteColumnDefinition(writer, column);
return new Statement(writer.ToString(), Statement.StatementType.Text, Statement.ResultType.None);
}
开发者ID:mikeobrien,项目名称:Gribble,代码行数:7,代码来源:SchemaWriter.cs
示例15: switch
public override int this[int address, Column column]
{
get
{
switch (column)
{
case Column.A:
return ValuesA[mod(address)];
case Column.B:
return ValuesB[mod(address)];
default:
throw new ApplicationException("Unknown register");
}
}
set
{
switch (column)
{
case Column.A:
ValuesA[mod(address)]=value;
break;
case Column.B:
ValuesB[mod(address)] = value;
break;
default:
throw new ApplicationException("Unknown register");
}
}
}
开发者ID:pavelsavara,项目名称:nMars,代码行数:29,代码来源:Fngine00Copy.cs
示例16: GetColumns
private Columns GetColumns(XmlNode tableOrViewNode)
{
XmlNode columnsNode = tableOrViewNode["c:Columns"];
if (columnsNode == null ||
columnsNode.ChildNodes.Count == 0) return null;
XmlNodeList columnNodes = columnsNode.ChildNodes;
Columns columns = new Columns(columnNodes.Count);
foreach (XmlNode columnNode in columnNodes)
{
string id = columnNode.Attributes["Id"].InnerText;
string displayName = columnNode["a:Name"].InnerText;
string name = columnNode["a:Code"].InnerText;
string comment = columnNode["a:Comment"] != null ? columnNode["a:Comment"].InnerText : string.Empty;
string dataType = columnNode["a:DataType"] != null ? columnNode["a:DataType"].InnerText : string.Empty;
string length = columnNode["a:Length"] != null ? columnNode["a:Length"].InnerText : "0";
string identity = columnNode["a:Identity"] != null ? columnNode["a:Identity"].InnerText : string.Empty;
string mandatory = columnNode["a:Mandatory"] != null ? columnNode["a:Mandatory"].InnerText : string.Empty;
string defaultValue = columnNode["a:DefaultValue"] != null ? columnNode["a:DefaultValue"].InnerText : string.Empty;
Column column = new Column(id, displayName, name, dataType, comment);
column.Length = Int32.Parse(length);
column.IsAutoIncremented = identity.Equals("1");
column.IsNullable = mandatory.Equals("1");
column.DefaultValue = defaultValue.ToEmpty();
column.DataType = Regex.Replace(column.DataType, "\\(.*?\\)", "");
column.OriginalName = name;
columns.Add(id, column);
}
return columns;
}
开发者ID:xianrendzw,项目名称:CodeBuilder,代码行数:32,代码来源:PowerDesigner12Exporter.cs
示例17: Calculation
private Calculation(Column column, Guid id, double operand, Operator @operator)
{
_column = column;
Id = id;
Operand = operand;
Operator = @operator;
}
开发者ID:xwipeoutx,项目名称:ddd-eventsource-demo,代码行数:7,代码来源:Calculation.cs
示例18: The_Rule_Fails_But_Only_For_The_Parent
public void The_Rule_Fails_But_Only_For_The_Parent()
{
var set = new MappingSetImpl();
var parentEntity = new EntityImpl("Parent");
var childEntity = new EntityImpl("Child");
childEntity.Parent = parentEntity;
var property = new PropertyImpl("Property1");
parentEntity.AddProperty(property);
set.EntitySet.AddEntity(parentEntity);
set.EntitySet.AddEntity(childEntity);
var table = new Table("Table1");
var column = new Column("Column1");
table.AddColumn(column);
set.Database.AddTable(table);
var rule = new CheckAllPropertiesMappedRule();
var result = rule.Run(set);
Assert.That(result.HasIssues);
Assert.That(result.Issues, Has.Count(1));
var issue = result.Issues[0];
Assert.That(issue.ErrorLevel, Is.EqualTo(ValidationErrorLevel.Warning));
Assert.That(issue.Object, Is.SameAs(property));
StringAssert.Contains("Property1", issue.Description);
StringAssert.Contains("Parent", issue.Description);
}
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:28,代码来源:Specs_For_All_Properties_Mapped.cs
示例19: UsesMySqlEscapeForColumns
public void UsesMySqlEscapeForColumns() {
var sb = new StringBuilder();
var col = new Column<int> { DbName = "foo", DbType = DbType.Int32, IsNullable = true };
this.MakeTarget().AppendColumnSpecification(sb, col);
Assert.Equal("`foo` int null", sb.ToString());
}
开发者ID:Polylytics,项目名称:dashing,代码行数:7,代码来源:MySqlDialectBaseTests.cs
示例20: createSnapshot
public DatabaseSnapshot createSnapshot(liquibase.database.Database database, string schema, java.util.Set listeners)
{
DatabaseSnapshot snapshot = new DatabaseSnapshot(database, schema);
OleDbConnection conn = ((AdoConnection)database.getConnection()).GetUnderlyingConnection();
string[] restrictions = new string[4];
restrictions[3] = "Table";
DataTable tables = conn.GetSchema("Tables", restrictions);
foreach (DataRow row in tables.Rows) {
Table table = new Table(row.Field<String>("TABLE_NAME"));
table.setSchema(row.Field<String>("TABLE_SCHEMA"));
snapshot.getTables().add(table);
DataTable tableInfo = conn.GetSchema("Columns", new string[4] { null, null, table.getName(), null });
foreach (DataRow colRow in tableInfo.Rows) {
Column column = new Column();
column.setName(colRow.Field<string>("COLUMN_NAME"));
column.setTable(table);
//column.setTypeName(colRow.Field<string>("DATA_TYPE"));
//column.setColumnSize(colRow.Field<int>("NUMERIC_SCALE"));
table.getColumns().add(column);
}
}
return snapshot;
}
开发者ID:kwhitmore,项目名称:GitTesting,代码行数:32,代码来源:OleDatabaseSnapshotGenerator.cs
注:本文中的Column类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论