A type that is defined as a class is a reference type. At run time, when you declare a variable of a reference type, the variable contains the value null until you explicitly create an instance of the class by using the new operator, or assign it an object of a compatible type that may have been created elsewhere.
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
#nullable disable
namespace MobileClaimsServices.Models
{
/// <summary>
/// Generated by Karen Payne's tool.
///
/// IMPORTANT:
/// The commented out attributes are for generating JSON
/// using a unit test method in MobileClaimsTest.TransToJsonFile()
/// which is currently marked as ignored, not to run as it will fail
/// unless Id and Identifier properties have the DataMember attributes
/// uncommented.
///
/// [NotMapped] is needed on Identifier property as it does not exists in the table
/// This is done for usage in several unit test not meant for a real app.
///
/// In a real solution we would never be flip-flopping around like this
/// but for teaching this is fine.
///
/// </summary>
public partial class IccTran
{
//[IgnoreDataMember]
public decimal Id { get; set; }
//[DataMember(Name = "Id")]
[NotMapped]
public int Identifier { get; set; }
public string TrSsn { get; set; }
public string TrAllDone { get; set; }
public string TrBye { get; set; }
public string TrChangePinInd { get; set; }
public string TrClaimFo { get; set; }
public DateTime? TrCompleteTime { get; set; }
public string TrHrsWorked { get; set; }
public string TrIcAcRoInd { get; set; }
public string TrIpAddress { get; set; }
public string TrIvrCode { get; set; }
public string TrLanguageCode { get; set; }
public DateTime? TrLastActivityTime { get; set; }
public string TrMfInd { get; set; }
public string TrNewHireInd { get; set; }
public string TrPin { get; set; }
public string TrPinTryNum { get; set; }
public string TrQ1aOnCert { get; set; }
public string TrQ1bOnCert { get; set; }
public string TrQ1cOnCert { get; set; }
public string TrQ2OnCert { get; set; }
public string TrQ3aOnCert { get; set; }
public string TrQ3bOnCert { get; set; }
public string TrQ3cOnCert { get; set; }
public string TrQ4OnCert { get; set; }
public string TrQuitCode { get; set; }
public string TrRtwDate { get; set; }
public DateTime? TrSatDate { get; set; }
public DateTime? TrStartTime { get; set; }
public string TrTransType { get; set; }
public string TrWagesEarned { get; set; }
public string TrWeekClaimed { get; set; }
public string TrWeekEndDate { get; set; }
public string TrWorkSearchInd { get; set; }
public string TrEbContact1 { get; set; }
public string TrEbContact2 { get; set; }
public string TrEbContact3 { get; set; }
public string TrEbDate1 { get; set; }
public string TrEbDate2 { get; set; }
public string TrEbDate3 { get; set; }
public string TrEbEmployer1 { get; set; }
public string TrEbEmployer2 { get; set; }
public string TrEbEmployer3 { get; set; }
public string TrEbLocation1 { get; set; }
public string TrEbLocation2 { get; set; }
public string TrEbLocation3 { get; set; }
public string TrEbTypeWork1 { get; set; }
public string TrEbTypeWork2 { get; set; }
public string TrEbTypeWork3 { get; set; }
public string TrEbAddtl { get; set; }
public string TrLastWeekClaimed { get; set; }
public string TrLastReferer { get; set; }
public string TrLastScreen { get; set; }
public string TrProgramEndWeek { get; set; }
public string TrLastRestartWeek { get; set; }
public string TrLastError { get; set; }
public string TrIpCountryCode { get; set; }
public string TrQ34tOnCert { get; set; }
public string TrQ44tOnCert { get; set; }
public string TrQ54tOnCert { get; set; }
public string TrEbResult1 { get; set; }
public string TrEbResult2 { get; set; }
public string TrEbResult3 { get; set; }
public string TrActivityDate1 { get; set; }
public string TrActivityDate2 { get; set; }
public string TrActivityDate3 { get; set; }
public string TrActivityDescr1 { get; set; }
public string TrActivityDescr2 { get; set; }
public string TrActivityDescr3 { get; set; }
public string TrTloExceptionFlag { get; set; }
public string TrUnionExceptionFlag { get; set; }
public string TrTloUnionPrecheckFlag { get; set; }
public decimal? TrGeoLatitude { get; set; }
public decimal? TrGeoLongitude { get; set; }
public string TrGeolocallowcdCode { get; set; }
public string TrMobdevcdCode { get; set; }
public string TrMobileFlag { get; set; }
public string TrMobileUserAgent { get; set; }
public string TrMobileOperatingSystem { get; set; }
public string TrPeucMsgShownFlag { get; set; }
public string TrLwaCertifyFlag { get; set; }
public DateTime? TrLwaSentToMfDate { get; set; }
}
}
Configuration for above model written using a tool which automates the process
using ConfigurationHelper.Classes;
using Microsoft.EntityFrameworkCore;
using MobileClaimsServices.Models;
#nullable disable
namespace MobileClaimsServices.Data
{
/// <summary>
/// Generated by Karen Payne's tool
/// </summary>
public partial class Context : DbContext
{
public Context()
{
}
public Context(DbContextOptions<Context> options)
: base(options)
{
}
public virtual DbSet<IccTran> IccTrans { get; set; }
{
if (!optionsBuilder.IsConfigured)
{
/*
* Gets connection string from a plain text json file.
* Of course there are ways to encrypt and decrypt which will be discussed.
*/
optionsBuilder.UseOracle(ApplicationSettings.Instance.ConnectionString);
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasDefaultSchema("OCS")
.HasAnnotation("Relational:Collation", "USING_NLS_COMP");
modelBuilder.Entity<IccTran>(entity =>
{
entity.ToTable("ICC_TRANS");
entity.HasIndex(e => e.TrAllDone, "ICCTRANS_DONE_CODE_I");
entity.HasIndex(e => e.TrEbTypeWork2, "ICCTRANS_EB_TYPE_WORK_2_I");
entity.HasIndex(e => e.TrLastActivityTime, "ICCTRANS_LACT_DATE_I");
entity.HasIndex(e => e.TrSsn, "ICCTRANS_SSN_I");
entity.HasIndex(e => new { e.TrTransType, e.TrAllDone, e.TrEbLocation1, e.TrCompleteTime }, "ICCTRANS_TRANS_ALL_EBLOC_TIM_I");
entity.HasIndex(e => e.TrWeekClaimed, "ICCTRANS_WEEK_CLAIMED_I");
entity.Property(e => e.Id)
.HasColumnType("NUMBER")
.HasColumnName("ID");
entity.Property(e => e.TrActivityDate1)
.HasMaxLength(8)
.IsUnicode(false)
.HasColumnName("TR_ACTIVITY_DATE_1");
entity.Property(e => e.TrActivityDate2)
.HasMaxLength(8)
.IsUnicode(false)
.HasColumnName("TR_ACTIVITY_DATE_2");
entity.Property(e => e.TrActivityDate3)
.HasMaxLength(8)
.IsUnicode(false)
.HasColumnName("TR_ACTIVITY_DATE_3");
entity.Property(e => e.TrActivityDescr1)
.HasMaxLength(2000)
.IsUnicode(false)
.HasColumnName("TR_ACTIVITY_DESCR_1");
entity.Property(e => e.TrActivityDescr2)
.HasMaxLength(2000)
.IsUnicode(false)
.HasColumnName("TR_ACTIVITY_DESCR_2");
entity.Property(e => e.TrActivityDescr3)
.HasMaxLength(2000)
.IsUnicode(false)
.HasColumnName("TR_ACTIVITY_DESCR_3");
entity.Property(e => e.TrAllDone)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_ALL_DONE")
.HasDefaultValueSql("'N'\n ");
entity.Property(e => e.TrBye)
.HasMaxLength(4)
.IsUnicode(false)
.HasColumnName("TR_BYE");
entity.Property(e => e.TrChangePinInd)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_CHANGE_PIN_IND")
.HasDefaultValueSql("NULL\n ");
entity.Property(e => e.TrClaimFo)
.HasMaxLength(4)
.IsUnicode(false)
.HasColumnName("TR_CLAIM_FO");
entity.Property(e => e.TrCompleteTime)
.HasColumnType("DATE")
.HasColumnName("TR_COMPLETE_TIME");
entity.Property(e => e.TrEbAddtl)
.IsUnicode(false)
.HasColumnName("TR_EB_ADDTL");
entity.Property(e => e.TrEbContact1)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_CONTACT_1");
entity.Property(e => e.TrEbContact2)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_CONTACT_2");
entity.Property(e => e.TrEbContact3)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_CONTACT_3");
entity.Property(e => e.TrEbDate1)
.HasMaxLength(8)
.IsUnicode(false)
.HasColumnName("TR_EB_DATE_1");
entity.Property(e => e.TrEbDate2)
.HasMaxLength(8)
.IsUnicode(false)
.HasColumnName("TR_EB_DATE_2");
entity.Property(e => e.TrEbDate3)
.HasMaxLength(8)
.IsUnicode(false)
.HasColumnName("TR_EB_DATE_3");
entity.Property(e => e.TrEbEmployer1)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_EMPLOYER_1");
entity.Property(e => e.TrEbEmployer2)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_EMPLOYER_2");
entity.Property(e => e.TrEbEmployer3)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_EMPLOYER_3");
entity.Property(e => e.TrEbLocation1)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_LOCATION_1");
entity.Property(e => e.TrEbLocation2)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_LOCATION_2");
entity.Property(e => e.TrEbLocation3)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_LOCATION_3");
entity.Property(e => e.TrEbResult1)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("TR_EB_RESULT_1");
entity.Property(e => e.TrEbResult2)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("TR_EB_RESULT_2");
entity.Property(e => e.TrEbResult3)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("TR_EB_RESULT_3");
entity.Property(e => e.TrEbTypeWork1)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_TYPE_WORK_1");
entity.Property(e => e.TrEbTypeWork2)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_TYPE_WORK_2");
entity.Property(e => e.TrEbTypeWork3)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_EB_TYPE_WORK_3");
entity.Property(e => e.TrGeoLatitude)
.HasColumnType("NUMBER(9,7)")
.HasColumnName("TR_GEO_LATITUDE");
entity.Property(e => e.TrGeoLongitude)
.HasColumnType("NUMBER(10,7)")
.HasColumnName("TR_GEO_LONGITUDE");
entity.Property(e => e.TrGeolocallowcdCode)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_GEOLOCALLOWCD_CODE");
entity.Property(e => e.TrHrsWorked)
.HasMaxLength(2)
.IsUnicode(false)
.HasColumnName("TR_HRS_WORKED");
entity.Property(e => e.TrIcAcRoInd)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_IC_AC_RO_IND");
entity.Property(e => e.TrIpAddress)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("TR_IP_ADDRESS");
entity.Property(e => e.TrIpCountryCode)
.HasMaxLength(2)
.IsUnicode(false)
.HasColumnName("TR_IP_COUNTRY_CODE");
entity.Property(e => e.TrIvrCode)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_IVR_CODE");
entity.Property(e => e.TrLanguageCode)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_LANGUAGE_CODE");
entity.Property(e => e.TrLastActivityTime)
.HasColumnType("DATE")
.HasColumnName("TR_LAST_ACTIVITY_TIME");
entity.Property(e => e.TrLastError)
.HasMaxLength(1000)
.IsUnicode(false)
.HasColumnName("TR_LAST_ERROR");
entity.Property(e => e.TrLastReferer)
.HasMaxLength(500)
.IsUnicode(false)
.HasColumnName("TR_LAST_REFERER");
entity.Property(e => e.TrLastRestartWeek)
.HasMaxLength(6)
.IsUnicode(false)
.HasColumnName("TR_LAST_RESTART_WEEK");
entity.Property(e => e.TrLastScreen)
.HasMaxLength(500)
.IsUnicode(false)
.HasColumnName("TR_LAST_SCREEN");
entity.Property(e => e.TrLastWeekClaimed)
.HasMaxLength(6)
.IsUnicode(false)
.HasColumnName("TR_LAST_WEEK_CLAIMED");
entity.Property(e => e.TrLwaCertifyFlag)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_LWA_CERTIFY_FLAG");
entity.Property(e => e.TrLwaSentToMfDate)
.HasColumnType("DATE")
.HasColumnName("TR_LWA_SENT_TO_MF_DATE");
entity.Property(e => e.TrMfInd)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_MF_IND")
.HasDefaultValueSql("'N'\n ");
entity.Property(e => e.TrMobdevcdCode)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_MOBDEVCD_CODE");
entity.Property(e => e.TrMobileFlag)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_MOBILE_FLAG");
entity.Property(e => e.TrMobileOperatingSystem)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("TR_MOBILE_OPERATING_SYSTEM");
entity.Property(e => e.TrMobileUserAgent)
.HasMaxLength(20)
.IsUnicode(false)
.HasColumnName("TR_MOBILE_USER_AGENT");
entity.Property(e => e.TrNewHireInd)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_NEW_HIRE_IND");
entity.Property(e => e.TrPeucMsgShownFlag)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_PEUC_MSG_SHOWN_FLAG")
.HasDefaultValueSql("''");
entity.Property(e => e.TrPin)
.HasMaxLength(4)
.IsUnicode(false)
.HasColumnName("TR_PIN");
entity.Property(e => e.TrPinTryNum)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_PIN_TRY_NUM");
entity.Property(e => e.TrProgramEndWeek)
.HasMaxLength(6)
.IsUnicode(false)
.HasColumnName("TR_PROGRAM_END_WEEK");
entity.Property(e => e.TrQ1aOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q1A_ON_CERT");
entity.Property(e => e.TrQ1bOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q1B_ON_CERT");
entity.Property(e => e.TrQ1cOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q1C_ON_CERT");
entity.Property(e => e.TrQ2OnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q2_ON_CERT");
entity.Property(e => e.TrQ34tOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q3_4T_ON_CERT");
entity.Property(e => e.TrQ3aOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q3A_ON_CERT");
entity.Property(e => e.TrQ3bOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q3B_ON_CERT");
entity.Property(e => e.TrQ3cOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q3C_ON_CERT");
entity.Property(e => e.TrQ44tOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q4_4T_ON_CERT");
entity.Property(e => e.TrQ4OnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q4_ON_CERT");
entity.Property(e => e.TrQ54tOnCert)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_Q5_4T_ON_CERT");
entity.Property(e => e.TrQuitCode)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_QUIT_CODE");
entity.Property(e => e.TrRtwDate)
.HasMaxLength(6)
.IsUnicode(false)
.HasColumnName("TR_RTW_DATE");
entity.Property(e => e.TrSatDate)
.HasColumnType("DATE")
.HasColumnName("TR_SAT_DATE");
entity.Property(e => e.TrSsn)
.IsRequired()
.HasMaxLength(9)
.IsUnicode(false)
.HasColumnName("TR_SSN");
entity.Property(e => e.TrStartTime)
.HasColumnType("DATE")
.HasColumnName("TR_START_TIME");
entity.Property(e => e.TrTloExceptionFlag)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_TLO_EXCEPTION_FLAG");
entity.Property(e => e.TrTloUnionPrecheckFlag)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_TLO_UNION_PRECHECK_FLAG");
entity.Property(e => e.TrTransType)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_TRANS_TYPE");
entity.Property(e => e.TrUnionExceptionFlag)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_UNION_EXCEPTION_FLAG");
entity.Property(e => e.TrWagesEarned)
.HasMaxLength(6)
.IsUnicode(false)
.HasColumnName("TR_WAGES_EARNED");
entity.Property(e => e.TrWeekClaimed)
.HasMaxLength(4)
.IsUnicode(false)
.HasColumnName("TR_WEEK_CLAIMED");
entity.Property(e => e.TrWeekEndDate)
.HasMaxLength(6)
.IsUnicode(false)
.HasColumnName("TR_WEEK_END_DATE");
entity.Property(e => e.TrWorkSearchInd)
.HasMaxLength(1)
.IsUnicode(false)
.HasColumnName("TR_WORK_SEARCH_IND");
});
modelBuilder.HasSequence("CLMADDRCHG_SEQ");
modelBuilder.HasSequence("CLMADDRVER_SEQ");
modelBuilder.HasSequence("CLMEMLSNT_SEQ");
modelBuilder.HasSequence("CLMINFOGGL_SEQ");
modelBuilder.HasSequence("CLMPINRES_SEQ");
modelBuilder.HasSequence("CLMPINRESA_SEQ");
modelBuilder.HasSequence("CLMPINTGGL_SEQ");
modelBuilder.HasSequence("CLMTEMLADD_SEQ");
modelBuilder.HasSequence("EBWRKSRCH_SEQ");
modelBuilder.HasSequence("EPIQLWACERT_SEQ");
modelBuilder.HasSequence("ICCHG_SEQ");
modelBuilder.HasSequence("ICCTRANS_SEQ");
modelBuilder.HasSequence("ICCTRCMMTS_SEQ");
modelBuilder.HasSequence("ICEMP_SEQ");
modelBuilder.HasSequence("ICRANDEMP_SEQ");
modelBuilder.HasSequence("ICRET_SEQ");
modelBuilder.HasSequence("ICSELFEMP_SEQ");
modelBuilder.HasSequence("ICSTATE_SEQ");
modelBuilder.HasSequence("ICSTFNOTE_SEQ");
modelBuilder.HasSequence("ICSTUD_SEQ");
modelBuilder.HasSequence("ICSTUDSCH_SEQ");
modelBuilder.HasSequence("ICSTUDWRKS_SEQ");
modelBuilder.HasSequence("ICTRANAUD_SEQ");
modelBuilder.HasSequence("ICTRANCB_SEQ");
modelBuilder.HasSequence("IMAPPSAF_SEQ");
modelBuilder.HasSequence("INSDOCTPCD_SEQ");
modelBuilder.HasSequence("LOGINTR_SEQ");
modelBuilder.HasSequence("LOGTRAN_SEQ");
modelBuilder.HasSequence("LOGTRANAPP_SEQ");
modelBuilder.HasSequence("LWAOP_SEQ");
modelBuilder.HasSequence("MAST5TTDIM_SEQ");
modelBuilder.HasSequence("MENUTRAN_SEQ");
modelBuilder.HasSequence("MEUCELGTOGGL_SEQ");
modelBuilder.HasSequence("OCSEBTRAN_SEQ");
modelBuilder.HasSequence("OCSERR_SEQ");
modelBuilder.HasSequence("OCSEXTBENTRN_SEQ");
modelBuilder.HasSequence("OCSLFTRAN_SEQ");
modelBuilder.HasSequence("OCSMSG_SEQ");
modelBuilder.HasSequence("OCSPATH_SEQ");
modelBuilder.HasSequence("OCSREPAYDC_SEQ");
modelBuilder.HasSequence("OCSREPAYTR_SEQ");
modelBuilder.HasSequence("OCSWSOUSGCNT_SEQ");
modelBuilder.HasSequence("PINCHG_SEQ");
modelBuilder.HasSequence("PUADLYVLD_SEQ");
modelBuilder.HasSequence("PUAEXHWKLF_SEQ");
modelBuilder.HasSequence("PUAGGLSTAT_SEQ");
modelBuilder.HasSequence("PUAICDET_SEQ");
modelBuilder.HasSequence("PUARCVAUD_SEQ");
modelBuilder.HasSequence("PUAWKDET_SEQ");
modelBuilder.HasSequence("QEMAILDOM_SEQ");
modelBuilder.HasSequence("SECANS_SEQ");
modelBuilder.HasSequence("SECQUES_SEQ");
modelBuilder.HasSequence("SEPANS_SEQ");
modelBuilder.HasSequence("SEPCLMSTAT_SEQ");
modelBuilder.HasSequence("SEQUENCETEST_SEQUENCE");
modelBuilder.HasSequence("SSAVERLOG_SEQ");
modelBuilder.HasSequence("UIBRVWANS_SEQ");
modelBuilder.HasSequence("UIDATES_SEQ");
modelBuilder.HasSequence("WAGSSNTRK_SEQ");
modelBuilder.HasSequence("WEBAPP_SEQ");
modelBuilder.HasSequence("WEBLOG_SEQ");
modelBuilder.HasSequence("WEBSYSOUT_SEQ");
modelBuilder.HasSequence("WKSHRAUDIT_SEQ");
modelBuilder.HasSequence("WKSHREMP_SEQ");
modelBuilder.HasSequence("WKSHRPLN_SEQ");
modelBuilder.HasSequence("WKSHRUNI_SEQ");
modelBuilder.HasSequence("Y_DEPARTMENT_SEQUENCE");
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
}