本文整理汇总了C#中DbColumn类的典型用法代码示例。如果您正苦于以下问题:C# DbColumn类的具体用法?C# DbColumn怎么用?C# DbColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbColumn类属于命名空间,在下文中一共展示了DbColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CsvReader
public CsvReader(TextReader reader, CsvReaderOptions options)
{
_lineReader = new LineReader(options, reader);
_cursor = _lineReader.GetLines().GetEnumerator();
// Read the first line, as we expect it to have headers
_cursor.MoveNext();
// The file format here is that the first row includes the
// columnHeaders in the format "<name>:<type>"
var columnHeaders = _cursor.Current;
var columns = new DbColumn[columnHeaders.Length];
for (var i = 0; i < columnHeaders.Length; i++) {
// Unquote headers
var header = columnHeaders[i].Replace("\"", "");
var splitHeader = header.Split(':');
if (splitHeader.Length == 2) {
var columnName = splitHeader[0];
var typeHeader = splitHeader[1];
var mungType = MungType.Parse(typeHeader);
columns[i] = new DbColumn(columnName, mungType);
} else {
columns[i] = new DbColumn(header, MungType.Get(MungTypeCode.String));
}
}
_columns = columns.ToList();
}
示例2: CheckTable
/// <summary>
///
/// </summary>
/// <param name="tableName"></param>
/// <param name="columns"></param>
/// <returns></returns>
public override bool CheckTable(string tableName, out DbColumn[] columns)
{
columns = null;
string commandText = string.Format("SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'{0}') AND type in (N'U')", tableName);
if (SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, commandText).ToInt() > 0)
{
var list = new List<DbColumn>();
commandText = string.Format("select c.name as ColumnName, t.name as ColumnType, c.scale, c.length,c.isnullable from syscolumns c join systypes t on c.xtype=t.xtype where t.name <> 'sysname' and c.id=object_id('{0}') order by colorder ASC", tableName);
using (var dataReader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, commandText))
{
while (dataReader.Read())
{
var column = new DbColumn();
column.Name = dataReader[0].ToNotNullString();
column.DbType = dataReader[1].ToNotNullString();
column.Scale = dataReader[2].ToInt();
column.Length = dataReader[3].ToLong();
column.Type = ConvertToObjectType(ConvertToDbType(column.DbType));
list.Add(column);
}
}
columns = list.ToArray();
return true;
}
return false;
}
示例3: LoadDb
public static DbTable LoadDb(DbDataReader reader)
{
if (!reader.Read()) {
return null;
}
var tbl = new DbTable((string)reader["TABLE_NAME"]);
var firstColumn = new DbColumn(
(string)reader["COLUMN_NAME"],
(string)reader["DATA_TYPE"]
);
tbl.Columns = new List<DbColumn>() { firstColumn };
while (reader.Read()) {
if (tbl.Name != (string)reader["TABLE_NAME"]) {
break;
}
tbl.Columns.Add(new DbColumn(
(string)reader["COLUMN_NAME"],
(string)reader["DATA_TYPE"]
));
}
return tbl;
}
示例4: CheckTable
/// <summary>
///
/// </summary>
/// <param name="tableName"></param>
/// <param name="columns"></param>
/// <returns></returns>
public override bool CheckTable(string tableName, out DbColumn[] columns)
{
columns = null;
string commandText = string.Format("SELECT count(1) FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`='{0}' AND `TABLE_NAME`='{1}'", ConnectionSetting.DatabaseName, tableName);
if (MySqlHelper.ExecuteScalar(ConnectionString, commandText).ToInt() > 0)
{
var list = new List<DbColumn>();
commandText = string.Format("SELECT Column_Name AS ColumnName,Data_Type AS ColumnType, NUMERIC_SCALE AS scale, CHARACTER_MAXIMUM_LENGTH AS Length FROM information_schema.`columns` WHERE `TABLE_SCHEMA`='{0}' AND `TABLE_NAME`='{1}'", ConnectionSetting.DatabaseName, tableName);
using (var dataReader = MySqlHelper.ExecuteReader(ConnectionString, commandText))
{
while (dataReader.Read())
{
var column = new DbColumn();
column.Name = dataReader[0].ToNotNullString();
column.DbType = dataReader[1].ToNotNullString();
column.Scale = dataReader[2].ToInt();
column.Length = dataReader[3].ToLong();
column.Type = ConvertToObjectType(ConvertToDbType(column.DbType));
list.Add(column);
}
}
columns = list.ToArray();
return true;
}
return false;
}
示例5: GetDatabaseCollection
/// <summary>
/// The get database collection.
/// </summary>
/// <param name="connectionString">
/// The connection string.
/// </param>
/// <param name="includeTable">
/// The include table.
/// </param>
/// <param name="includeColumn">
/// The include column.
/// </param>
/// <returns>
/// The <see cref="DatabaseCollection"/>.
/// </returns>
public DatabaseCollection GetDatabaseCollection(
string connectionString,
bool includeTable = false,
bool includeColumn = false)
{
var databaseCollection = new DatabaseCollection();
using (var sqlConnection = new SqlConnection(connectionString))
{
var serverConnection = new ServerConnection(sqlConnection);
var server = new Server(serverConnection);
foreach (
var database in
server.Databases.Cast<Database>().AsQueryable().Where(d => d.IsSystemObject == false))
{
var dbItem = new EntityTemplate.Database { Name = database.Name };
if (includeTable && database.Tables.Count > 0)
{
foreach (var table in database.Tables.Cast<Table>().AsQueryable().Where(t => t.IsSystemObject == false))
{
var dbTableItem = new DbTable { Name = table.Name };
dbTableItem.Description = table.ExtendedProperties.Count > 0 ? table.ExtendedProperties["MS_Description"].Value.ToString() : string.Empty;
if (includeColumn && table.Columns.Count > 0)
{
foreach (var column in table.Columns.Cast<Column>().AsQueryable())
{
var dbColumnItem = new DbColumn();
dbColumnItem.Name = column.Name;
dbColumnItem.Description = column.ExtendedProperties.Count > 0 ? column.ExtendedProperties["MS_Description"].Value.ToString() : string.Empty;
dbColumnItem.IsPrimaryKey = column.InPrimaryKey;
dbColumnItem.IsIdentityColumn = column.Identity;
dbColumnItem.ColumnType = column.DataType.SqlDataType.ToString();
dbColumnItem.AllowEmpty = column.Nullable;
dbColumnItem.DefaultValue = column.Default;
dbTableItem.Columns.Add(dbColumnItem);
}
}
dbItem.Tables.Add(dbTableItem);
}
}
databaseCollection.Add(dbItem);
}
}
return databaseCollection;
}
示例6: qCom_Contact
protected qCom_Contact(DbRow c)
{
container = c;
container.SetContainerName("qCom_Contacts");
contact_id = container.NewColumn<Int32>("ContactID", true);
scope_id = container.NewColumn<Int32>("ScopeID");
available = container.NewColumn<String>("Available");
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
last_modified = container.NewColumn<DateTime?>("LastModified");
last_modified_by = container.NewColumn<Int32>("LastModifiedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
first_name = container.NewColumn<String>("FirstName");
last_name = container.NewColumn<String>("LastName");
email = container.NewColumn<String>("Email");
keywords = container.NewColumn<String>("Keywords");
source = container.NewColumn<String>("Source");
user_id = container.NewColumn<Int32>("UserID");
ok_email = container.NewColumn<String>("OkEmail");
did = container.NewColumn<String>("DID");
partner = container.NewColumn<String>("Partner");
main_group = container.NewColumn<Int32>("MainGroup");
sub_group = container.NewColumn<Int32>("SubGroup");
custom_html_element = container.NewColumn<String>("CustomHTMLElement");
dm_misc = container.NewColumn<String>("DM_Misc");
unsubscribed = container.NewColumn<DateTime?>("Unsubscribed");
unsubscribed_campaign_id = container.NewColumn<Int32>("UnsubscribedCampaignID");
reported_as_spam = container.NewColumn<DateTime?>("ReportedAsSpam");
reported_as_spam_campaign_id = container.NewColumn<Int32>("ReportedAsSpamCampaignID");
action_log = container.NewColumn<String>("ActionLog");
}
示例7: qPtl_RoleAction
protected qPtl_RoleAction(DbRow c)
{
container = c;
container.SetContainerName("qPtl_RoleActions");
role_action_id = container.NewColumn<Int32>("RoleActionID", true);
scope_id = container.NewColumn<Int32>("ScopeID");
available = container.NewColumn<String>("Available");
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
last_modified = container.NewColumn<DateTime?>("LastModified");
last_modified_by = container.NewColumn<Int32?>("LastModifiedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
role_id = container.NewColumn<Int32>("RoleID");
action_id = container.NewColumn<Int32>("ActionID");
start_days_from_now = container.NewColumn<Int32>("StartDaysFromNow");
end_days_from_now = container.NewColumn<Int32>("EndDaysFromNow");
after_num_logins = container.NewColumn<Int32>("AfterNumLogins");
priority = container.NewColumn<Int32>("Priority");
skip_allowed = container.NewColumn<String>("SkipAllowed");
number_skips_allowed = container.NewColumn<Int32>("NumberSkipsAllowed");
required = container.NewColumn<String>("Required");
option_opt_out = container.NewColumn<String>("OptionOptOut");
redirect_url = container.NewColumn<String>("RedirectURL");
redirect_skip_url = container.NewColumn<String>("RedirectSkipURL");
}
示例8: qPtl_Task
protected qPtl_Task(DbRow c)
{
container = c;
container.SetContainerName("qPtl_Tasks");
task_id = container.NewColumn<Int32>("TaskID", true);
scope_id = container.NewColumn<Int32>("ScopeID");
available = container.NewColumn<String>("Available");
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
last_modified = container.NewColumn<DateTime?>("LastModified");
last_modified_by = container.NewColumn<Int32?>("LastModifiedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
task_type_id = container.NewColumn<Int32>("TaskTypeID");
assigned_to = container.NewColumn<Int32?>("AssignedTo");
assigned_text = container.NewColumn<String>("AssignedText");
start_date = container.NewColumn<DateTime?>("StartDate");
due_date = container.NewColumn<DateTime?>("DueDate");
percent_completed = container.NewColumn<Double>("PercentCompleted");
status = container.NewColumn<String>("Status");
name = container.NewColumn<String>("Name");
description = container.NewColumn<String>("Description");
importance = container.NewColumn<Int32>("Importance");
content_type_id = container.NewColumn<Int32>("ContentTypeID");
reference_id = container.NewColumn<Int32>("ReferenceID");
}
示例9: qOrg_School
protected qOrg_School(DbRow c)
{
container = c;
container.SetContainerName("qOrg_Schools");
school_id = container.NewColumn<Int32>("SchoolID", true);
scope_id = container.NewColumn<Int32>("ScopeID");
available = container.NewColumn<String>("Available");
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
last_modified = container.NewColumn<DateTime?>("LastModified");
last_modified_by = container.NewColumn<Int32>("LastModifiedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
school_selector = container.NewColumn<String>("SchoolSelector");
school = container.NewColumn<String>("School");
address1 = container.NewColumn<String>("Address1");
address2 = container.NewColumn<String>("Address2");
city = container.NewColumn<String>("City");
state_province = container.NewColumn<String>("StateProvince");
postal_code = container.NewColumn<String>("PostalCode");
country = container.NewColumn<String>("Country");
district = container.NewColumn<String>("District");
school_type = container.NewColumn<String>("SchoolType");
school_level = container.NewColumn<String>("SchoolLevel");
school_district_id = container.NewColumn<Int32>("SchoolDistrictID");
school_phone = container.NewColumn<String>("SchoolPhone");
school_fax = container.NewColumn<String>("SchoolFax");
longitude = container.NewColumn<Decimal>("Longitude");
latitude = container.NewColumn<Decimal>("Latitude");
}
示例10: qPtl_User
protected qPtl_User(DbRow c)
{
container = c;
container.SetContainerName("qPtl_Users");
user_id = container.NewColumn<Int32>("UserID", true);
org_unit_id = container.NewColumn<Int32>("OrgUnitID");
scope_id = container.NewColumn<Int32>("ScopeID");
available = container.NewColumn<String>("Available");
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
last_modified = container.NewColumn<DateTime?>("LastModified");
last_modified_by = container.NewColumn<Int32>("LastModifiedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
username = container.NewColumn<String>("UserName");
password = container.NewColumn<String>("Password");
password_reset_code = container.NewColumn<String>("PasswordResetCode");
first_name = container.NewColumn<String>("FirstName");
last_name = container.NewColumn<String>("LastName");
email = container.NewColumn<String>("Email");
comments = container.NewColumn<String>("Comments");
dm_user_id = container.NewColumn<Int32>("DM_UserID");
dm_status_id = container.NewColumn<Int32>("DM_StatusID");
highest_role = container.NewColumn<String>("HighestRole");
highest_rank = container.NewColumn<Int32>("HighestRank");
last_time_seen = container.NewColumn<DateTime?>("LastTimeSeen");
last_ip_address = container.NewColumn<String>("LastIPAddress");
profile_pict = container.NewColumn<String>("ProfilePict");
status = container.NewColumn<String>("Status");
status_date = container.NewColumn<DateTime?>("StatusDate");
account_status = container.NewColumn<String>("AccountStatus");
last_activity = container.NewColumn<Int32>("LastActivity");
number_logins = container.NewColumn<Int32>("NumberLogins");
registration_type = container.NewColumn<String>("RegistrationType");
registration_notes = container.NewColumn<String>("RegistrationNotes");
}
示例11: qHtl_AbsenteeAnalysisVariable
protected qHtl_AbsenteeAnalysisVariable(DbRow c)
{
container = c;
container.SetContainerName("qHtl_AbsenteeAnalysisVariables");
absentee_analysis_variable_id = container.NewColumn<Int32>("AbsenteeAnalysisVariableID", true);
school_district_id = container.NewColumn<Int32>("SchoolDistrictID");
solution_start_date = container.NewColumn<DateTime?>("SolutionStartDate");
green_rate_std_multiplier = container.NewColumn<Decimal>("GreenRateSTDMultiplier");
yellow_rate_std_multiplier = container.NewColumn<Decimal>("YellowRateSTDMultiplier");
red_rate_std_multiplier = container.NewColumn<Decimal>("RedRateSTDMultiplier");
green_illness_boundary = container.NewColumn<Decimal>("GreenIllnessBoundary");
yellow_illness_boundary = container.NewColumn<Decimal>("YellowIllnessBoundary");
red_illness_boundary = container.NewColumn<Decimal>("RedIllnessBoundary");
green_gastrointestinal_boundary = container.NewColumn<Decimal>("GreenGastrointestinalBoundary");
yellow_gastrointestinal_boundary = container.NewColumn<Decimal>("YellowGastrointestinalBoundary");
red_gastrointestinal_boundary = container.NewColumn<Decimal>("RedGastrointestinalBoundary");
green_respiratory_boundary = container.NewColumn<Decimal>("GreenRespiratoryBoundary");
yellow_respiratory_boundary = container.NewColumn<Decimal>("YellowRespiratoryBoundary");
red_respiratory_boundary = container.NewColumn<Decimal>("RedRespiratoryBoundary");
green_rash_boundary = container.NewColumn<Decimal>("GreenRashBoundary");
yellow_rash_boundary = container.NewColumn<Decimal>("YellowRashBoundary");
red_rash_boundary = container.NewColumn<Decimal>("RedRashBoundary");
green_other_illness_boundary = container.NewColumn<Decimal>("GreenOtherIllnessBoundary");
yellow_other_illness_boundary = container.NewColumn<Decimal>("YellowOtherIllnessBoundary");
red_other_illness_boundary = container.NewColumn<Decimal>("RedOtherIllnessBoundary");
green_unknown_illness_boundary = container.NewColumn<Decimal>("GreenUnknownIllnessBoundary");
yellow_unknown_illness_boundary = container.NewColumn<Decimal>("YellowUnknownIllnessBoundary");
red_unknown_illness_boundary = container.NewColumn<Decimal>("RedUnknownIllnessBoundary");
sd_formula_type = container.NewColumn<String>("SDFormulaType");
}
示例12: qHtl_HealthProvider
protected qHtl_HealthProvider(DbRow c)
{
container = c;
container.SetContainerName("qHtl_HealthProviders");
health_provider_id = container.NewColumn<Int32>("HealthProviderID", true);
scope_id = container.NewColumn<Int32>("ScopeID");
available = container.NewColumn<String>("Available");
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
last_modified = container.NewColumn<DateTime?>("LastModified");
last_modified_by = container.NewColumn<Int32>("LastModifiedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
health_provider_type = container.NewColumn<String>("HealthProviderType");
name = container.NewColumn<String>("name");
description = container.NewColumn<String>("description");
address1 = container.NewColumn<String>("Address1");
address2 = container.NewColumn<String>("Address2");
city = container.NewColumn<String>("City");
state_province = container.NewColumn<String>("StateProvince");
postal_code = container.NewColumn<String>("PostalCode");
country = container.NewColumn<String>("Country");
phone = container.NewColumn<String>("Phone");
website = container.NewColumn<String>("Website");
service_type = container.NewColumn<String>("ServiceType");
service_categories = container.NewColumn<String>("ServiceCategories");
}
示例13: qHtl_HealthWarning
protected qHtl_HealthWarning(DbRow c)
{
container = c;
container.SetContainerName("qHtl_HealthWarnings");
health_warning_id = container.NewColumn<Int32>("HealthWarningID", true);
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
data_date = container.NewColumn<DateTime?>("DataDate");
type = container.NewColumn<String>("Type");
title = container.NewColumn<String>("Title");
text = container.NewColumn<String>("Text");
notes = container.NewColumn<String>("Notes");
severity = container.NewColumn<String>("Severity");
issued_by = container.NewColumn<Int32>("IssuedBy");
issued_by_name = container.NewColumn<String>("IssuedByName");
review_status = container.NewColumn<String>("ReviewStatus");
issued_to = container.NewColumn<String>("IssuedTo");
valid_from = container.NewColumn<DateTime?>("ValidFrom");
valid_until = container.NewColumn<DateTime?>("ValidUntil");
multiple_classrooms = container.NewColumn<String>("MultipleClassrooms");
multiple_schools = container.NewColumn<String>("MultipleSchools");
school_levels = container.NewColumn<String>("SchoolLevels");
content_type_id = container.NewColumn<Int32>("ContentTypeID");
reference_id = container.NewColumn<Int32>("ReferenceID");
email_id = container.NewColumn<Int32>("EmailID");
notification_id = container.NewColumn<Int32>("NotificationID");
sms_message_id = container.NewColumn<Int32>("SMSMessageID");
}
示例14: qPtl_UserRole
protected qPtl_UserRole(DbRow c)
{
container = c;
container.SetContainerName("qPtl_UserRoles");
user_id = container.NewColumn<Int32>("UserID", true);
role_id = container.NewColumn<Int32>("RoleID", true);
}
示例15: qPtl_UserAction
protected qPtl_UserAction(DbRow c)
{
container = c;
container.SetContainerName("qPtl_UserActions");
user_action_id = container.NewColumn<Int32>("UserActionID", true);
scope_id = container.NewColumn<Int32>("ScopeID");
available = container.NewColumn<String>("Available");
created = container.NewColumn<DateTime>("Created");
created_by = container.NewColumn<Int32>("CreatedBy");
last_modified = container.NewColumn<DateTime?>("LastModified");
last_modified_by = container.NewColumn<Int32?>("LastModifiedBy");
mark_as_delete = container.NewColumn<Int32>("MarkAsDelete");
user_id = container.NewColumn<Int32>("UserID");
action_id = container.NewColumn<Int32>("ActionID");
assign_type = container.NewColumn<String>("AssignType");
available_from = container.NewColumn<DateTime?>("AvailableFrom");
available_to = container.NewColumn<DateTime?>("AvailableTo");
after_num_logins = container.NewColumn<Int32>("AfterNumLogins");
priority = container.NewColumn<Int32>("Priority");
skip_allowed = container.NewColumn<String>("SkipAllowed");
number_skips_allowed = container.NewColumn<Int32>("NumberSkipsAllowed");
required = container.NewColumn<String>("Required");
optional_opt_out = container.NewColumn<String>("OptionalOptOut");
user_completed = container.NewColumn<DateTime?>("UserCompleted");
user_opt_out = container.NewColumn<DateTime?>("UserOptOut");
user_num_skips = container.NewColumn<Int32>("UserNumSkips");
user_last_skip = container.NewColumn<DateTime?>("UserLastSkip");
last_user_action_session_id = container.NewColumn<Int32>("LastUserActionSessionID");
reference_id = container.NewColumn<Int32>("ReferenceID");
redirect_url = container.NewColumn<String>("RedirectURL");
redirect_skip_url = container.NewColumn<String>("RedirectSkipURL");
}