本文整理汇总了C#中Column类的典型用法代码示例。如果您正苦于以下问题:C# Column类的具体用法?C# Column怎么用?C# Column使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Column类属于命名空间,在下文中一共展示了Column类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例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;
}
示例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();
}
示例5: CrossTabResults
public CrossTabResults(List<Column> groupByColumns, Column crossTabColumn, List<Column> summarizeColumns, List<string> crossTabColumnVaues)
{
_groupByColumns = groupByColumns;
_crossTabColumn = crossTabColumn;
_summarizeColumns = summarizeColumns;
_crossTabColumnVaues = crossTabColumnVaues;
}
示例6: CopyTo
public override Column CopyTo(Column column)
{
var textColumn = (TextColumn)column;
textColumn.CharLength = CharLength;
textColumn.ByteLength = ByteLength;
return base.CopyTo(textColumn);
}
示例7: TableJoin
public TableJoin(Table master, Column masterColumn, Table detail, Column detailColumn)
{
_master = master;
_masterColumn = masterColumn;
_detailColumn = detailColumn;
_detail = detail;
}
示例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();
}
示例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;
}
示例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;
}
}
示例11: CanGenerate
public override bool CanGenerate(Column column)
{
if (IsGeneratedColumn(column) || IsForeginKey(column))
return false;
return IsNumericDbType(column.CodeFluentType.DbType);
}
示例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);
}
示例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;
}
示例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);
}
示例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");
}
}
}