本文整理汇总了C#中IDataRecord.GetValueOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# IDataRecord.GetValueOrDefault方法的具体用法?C# IDataRecord.GetValueOrDefault怎么用?C# IDataRecord.GetValueOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataRecord
的用法示例。
在下文中一共展示了IDataRecord.GetValueOrDefault方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Period
public Period(IDataRecord dr)
{
Id = dr.GetValueOrDefault<int>("Id");
QuestId = dr.GetValueOrDefault<int>("QuestId");
BeginTime = dr.GetValueOrDefault<TimeSpan>("BeginTime");
EndTime = dr.GetValueOrDefault<TimeSpan>("EndTime");
Booked = dr.GetValueOrDefault<bool>("Booked");
}
示例2: User
public User(IDataRecord dr)
{
Id = dr.GetValueOrDefault<int>("Id");
Login = dr.GetValueOrDefault<string>("Login");
Name = dr.GetValueOrDefault<string>("Name");
Active = dr.GetValueOrDefault<bool>("Active");
Email = dr.GetValueOrDefault<string>("Email");
}
示例3: Cost
public Cost(IDataRecord dr)
{
Id = dr.GetValueOrDefault<int>("Id");
Persons = dr.GetValueOrDefault<string>("Persons");
WorkdaysDay = dr.GetValueOrDefault<int>("WorkdaysDay");
WorkdaysEvening = dr.GetValueOrDefault<int>("WorkdaysEvening");
Weekends = dr.GetValueOrDefault<int>("Weekends");
}
示例4: Quest
public Quest(IDataRecord dr)
{
Id = dr.GetValueOrDefault<int>("Id");
Name = dr.GetValueOrDefault<string>("Name");
Description = dr.GetValueOrDefault<string>("Description");
Complexity = dr.GetValueOrDefault<int>("Complexity");
Persons = dr.GetValueOrDefault<string>("Persons");
Duration = dr.GetValueOrDefault<TimeSpan>("Duration");
Active = dr.GetValueOrDefault<bool>("Active");
Visible = dr.GetValueOrDefault<bool>("Visible");
Note = dr.GetValueOrDefault<string>("Note");
}
示例5: CreateMembershipEntry
private static Tuple<MembershipEntry, string, int, string> CreateMembershipEntry(IDataRecord record)
{
//TODO: This is a bit of hack way to check in the current version if there's membership data or not, but if there's a start time, there's member.
DateTime? startTime = record.GetValueOrDefault<DateTime?>("StartTime");
MembershipEntry entry = null;
if(startTime.HasValue)
{
int port = record.GetValue<int>("Port");
int generation = record.GetValue<int>("Generation");
string address = record.GetValue<string>("Address");
entry = new MembershipEntry
{
SiloAddress = SiloAddress.New(new IPEndPoint(IPAddress.Parse(address), port), generation),
HostName = record.GetValueOrDefault<string>("HostName"),
Status = record.GetValue<SiloStatus>("Status"),
ProxyPort = record.GetValueOrDefault<int>("ProxyPort"),
RoleName = record.GetValue<string>("RoleName"),
InstanceName = record.GetValue<string>("InstanceName"),
UpdateZone = record.GetValue<int>("UpdateZone"),
StartTime = startTime.GetValueOrDefault(),
FaultZone = record.GetValueOrDefault<int>("FaultZone"),
IAmAliveTime = record.GetValueOrDefault<DateTime>("IAmAliveTime")
};
//TODO: Refactor the database with regard to these.
string suspectingSilo = record.GetValueOrDefault<string>("SuspectingSilos");
string suspectingTime = record.GetValueOrDefault<string>("SuspectingTimes");
List<SiloAddress> suspectingSilos = new List<SiloAddress>();
List<DateTime> suspectingTimes = new List<DateTime>();
if(!string.IsNullOrWhiteSpace(suspectingSilo))
{
string[] silos = suspectingSilo.Split('|');
foreach(string silo in silos)
{
suspectingSilos.Add(SiloAddress.FromParsableString(silo));
}
}
if(!string.IsNullOrWhiteSpace(suspectingTime))
{
string[] times = suspectingTime.Split('|');
foreach(string time in times)
{
suspectingTimes.Add(TraceLogger.ParseDate(time));
}
}
if(suspectingSilos.Count != suspectingTimes.Count)
{
throw new OrleansException(string.Format("SuspectingSilos.Length of {0} as read from SQL table is not equal to SuspectingTimes.Length of {1}", suspectingSilos.Count, suspectingTimes.Count));
}
for(int i = 0; i < suspectingSilos.Count; ++i)
{
entry.AddSuspector(suspectingSilos[i], suspectingTimes[i]);
}
}
string etag = Convert.ToBase64String(record.GetValue<byte[]>("ETag"));
int tableVersion = (int)record.GetValueOrDefault<long>("Version");
string versionETag = Convert.ToBase64String(record.GetValueOrDefault<byte[]>("VersionETag"));
return Tuple.Create(entry, etag, tableVersion, versionETag);
}
示例6: CreateReminderEntry
private static ReminderEntry CreateReminderEntry(IDataRecord record)
{
//Having non-null field, GrainId, means with the query filter options, an entry was found.
if(record.GetValueOrDefault<string>("GrainId") != null)
{
return new ReminderEntry
{
GrainRef = GrainReference.FromKeyString(record.GetValue<string>("GrainId")),
ReminderName = record.GetValue<string>("ReminderName"),
StartAt = record.GetValue<DateTime>("StartTime"),
Period = TimeSpan.FromMilliseconds(record.GetValue<int>("Period")),
ETag = Convert.ToBase64String(record.GetValue<byte[]>("ETag"))
};
}
return null;
}
示例7: ReporterC2C
/// <summary>
/// constructor
/// </summary>
/// <param name="dataRecord"></param>
public ReporterC2C(IDataRecord dataRecord)
{
this.Id = dataRecord.GetValueOrDefault<int>("Id");
this.CNTYNAME = dataRecord.GetValueOrDefault<string>("CNTYNAME").Replace("'", string.Empty);
this.DISTNAME = dataRecord.GetValueOrDefault<string>("DISTNAME");
this.CAMPUS = dataRecord.GetValueOrDefault<string>("CAMPUS");
this.CAMPNAME = dataRecord.GetValueOrDefault<string>("CAMPNAME");
this.CFLALTED = dataRecord.GetValueOrDefault<string>("CFLALTED");
this.CFLCHART = dataRecord.GetValueOrDefault<string>("CFLCHART");
this.GRDSPAN = dataRecord.GetValueOrDefault<string>("GRDSPAN");
this.GRDTYPE = dataRecord.GetValueOrDefault<string>("GRDTYPE");
this.CPETALLC = dataRecord.GetValueOrDefault<int>("CPETALLC");
this.CPETBLAC = dataRecord.GetValueOrDefault<int>("CPETBLAC");
this.CPETHISC = dataRecord.GetValueOrDefault<int>("CPETHISC");
this.CPETWHIC = dataRecord.GetValueOrDefault<int>("CPETWHIC");
this.CPETECOC = dataRecord.GetValueOrDefault<int>("CPETECOC");
this.CPETLEPC = dataRecord.GetValueOrDefault<int>("CPETLEPC");
this.CPETRSKC = dataRecord.GetValueOrDefault<decimal>("CPETRSKC");
this.CPETBLAP = dataRecord.GetValueOrDefault<decimal>("CPETBLAP");
this.CPETHISP = dataRecord.GetValueOrDefault<decimal>("CPETHISP");
this.CPETWHIP = dataRecord.GetValueOrDefault<decimal>("CPETWHIP");
this.CPETECOP = dataRecord.GetValueOrDefault<decimal>("CPETECOP");
this.CPETLEPP = dataRecord.GetValueOrDefault<decimal>("CPETLEPP");
this.CPETRSKP = dataRecord.GetValueOrDefault<decimal>("CPETRSKP");
this.CPEMALLP = dataRecord.GetValueOrDefault<decimal>("CPEMALLP");
this.CPETSPEP = dataRecord.GetValueOrDefault<decimal>("CPETSPEP");
this.CPETGPKC = dataRecord.GetValueOrDefault<int>("CPETGPKC");
this.Estimated_Eligible_1st_Graders = dataRecord.GetValueOrDefault<decimal>("Estimated_Eligible_1st_Graders");
this.CPETGPKP = dataRecord.GetValueOrDefault<decimal>("CPETGPKP");
this.Num_Not_Enrolled = dataRecord.GetValueOrDefault<decimal>("Num_Not_Enrolled");
this.attendance_rate = dataRecord.GetValueOrDefault<decimal>("attendance_rate");
this.Graduates = dataRecord.GetValueOrDefault<decimal>("Graduates");
this.percent_test_taking = dataRecord.GetValueOrDefault<decimal>("percent_test_taking");
this.percent_above_criterion = dataRecord.GetValueOrDefault<decimal>("percent_above_criterion");
this.percent_college_ready = dataRecord.GetValueOrDefault<int>("percent_college_ready");
this.number_not_college_ready = dataRecord.GetValueOrDefault<int>("number_not_college_ready");
this.percent_graduating_4_years = dataRecord.GetValueOrDefault<decimal>("percent_graduating_4_years");
this.three_r_d = dataRecord.GetValueOrDefault<int>("3_r_d");
this.three_r_rec = dataRecord.GetValueOrDefault<int>("3_r_rec");
this.three_r_not_rec = dataRecord.GetValueOrDefault<int>("3_r_not_rec");
this.three_r_rec_rate = dataRecord.GetValueOrDefault<decimal>("3_r_rec_rate");
this.four_m_d = dataRecord.GetValueOrDefault<int>("4_m_d");
this.four_m_rec = dataRecord.GetValueOrDefault<int>("4_m_rec");
this.four_m_not_rec = dataRecord.GetValueOrDefault<int>("4_m_not_rec");
this.four_m_rec_rate = dataRecord.GetValueOrDefault<decimal>("4_m_rec_rate");
this.eight_s_d = dataRecord.GetValueOrDefault<int>("8_s_d");
this.eight_s_rec = dataRecord.GetValueOrDefault<int>("8_s_rec");
this.eight_s_not_rec = dataRecord.GetValueOrDefault<int>("8_s_not_rec");
this.eight_s_rec_rate = dataRecord.GetValueOrDefault<decimal>("8_s_rec_rate");
this.a1_EOC_d = dataRecord.GetValueOrDefault<int>("a1_EOC_d");
this.a1_EOC_rec = dataRecord.GetValueOrDefault<int>("a1_EOC_rec");
this.a1_EOC_not_rec = dataRecord.GetValueOrDefault<int>("a1_EOC_not_rec");
this.a1_EOC_rec_rate = dataRecord.GetValueOrDefault<decimal>("a1_EOC_rec_rate");
}
示例8: Promocode
public Promocode(IDataRecord dr)
{
Id = dr.GetValueOrDefault<int>("ID");
Code = dr.GetValueOrDefault<string>("CODE");
Factor = dr.GetValueOrDefault<double>("FACTOR");
}
示例9: Booking
public Booking(IDataRecord dr)
{
Id = dr.GetValueOrDefault<int>("Id");
QuestId = dr.GetValueOrDefault<int>("QuestId");
QuestName = dr.GetValueOrDefault<string>("QuestName");
Date = dr.GetValueOrDefault<DateTime>("Date");
PlayerName = dr.GetValueOrDefault<string>("PlayerName");
Email = dr.GetValueOrDefault<string>("Email");
Phone = dr.GetValueOrDefault<string>("Phone");
Comment = dr.GetValueOrDefault<string>("Comment");
Status = (BookingStatus)dr.GetValueOrDefault<byte>("Status");
Created = dr.GetValueOrDefault<DateTime>("Created");
OperatorId = dr.GetValueOrDefault<int?>("OperatorId");
OperatorName = dr.GetValueOrDefault<string>("OperatorName");
Processed = dr.GetValueOrDefault<DateTime?>("Processed");
Cost = dr.GetValueOrDefault<int>("Cost");
Persons = dr.GetValueOrDefault<string>("Persons");
}
示例10: FeedbackMessage
public FeedbackMessage(IDataRecord dr)
{
Id = dr.GetValueOrDefault<int>("Id");
QuestId = dr.GetValueOrDefault<int>("QuestId");
QuestName = dr.GetValueOrDefault<string>("QuestName");
Created = dr.GetValueOrDefault<DateTime>("Created");
PlayerName = dr.GetValueOrDefault<string>("PlayerName");
Email = dr.GetValueOrDefault<string>("Email");
Text = dr.GetValueOrDefault<string>("Text");
Status = (FeedbackMessageStatus)dr.GetValueOrDefault<byte>("Status");
Processed = dr.GetValueOrDefault<DateTime?>("Processed");
OperatorId = dr.GetValueOrDefault<int?>("OperatorId");
OperatorName = dr.GetValueOrDefault<string>("OperatorName");
}