DataConnector | ComponentOne
In This Topic
    ServiceNowContext
    In This Topic
    
    using System;
    using Microsoft.EntityFrameworkCore;
    using Microsoft.EntityFrameworkCore.Metadata;
    
    namespace ServiceNow_EF_3._1.GeneratedCode
    {
        public partial class ServiceNowContext : DbContext
        {
            public ServiceNowContext()
            {
                Database.AutoTransactionsEnabled = false;
            }
    
            public ServiceNowContext(DbContextOptions options)
                : base(options)
            {
                Database.AutoTransactionsEnabled = false;
            }
    
            public virtual DbSet Incident { get; set; }
    
            protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
            {
                if (!optionsBuilder.IsConfigured)
                {
                	optionsBuilder.UseServiceNow("Username=*****;Password=*****;OAuth Client Id=*****;OAuth Client Secret=*****;
                    OAuth Token Endpoint=********;Url=https://***");
                }
            }
    
            protected override void OnModelCreating(ModelBuilder modelBuilder)
            {
                modelBuilder.Entity(entity =>
                {
                    entity.HasKey(e => e.SysId);
    
                    entity.ToTable("incident");
    
                    entity.Property(e => e.SysId).HasColumnName("sys_id");
    
                    entity.Property(e => e.Active).HasColumnName("active");
    
                    entity.Property(e => e.ActivityDue).HasColumnName("activity_due");
    
                    entity.Property(e => e.AdditionalAssigneeList).HasColumnName("additional_assignee_list");
    
                    entity.Property(e => e.Approval).HasColumnName("approval");
    
                    entity.Property(e => e.ApprovalHistory).HasColumnName("approval_history");
    
                    entity.Property(e => e.ApprovalSet).HasColumnName("approval_set");
    
                    entity.Property(e => e.AssignedTo).HasColumnName("assigned_to");
    
                    entity.Property(e => e.AssignmentGroup).HasColumnName("assignment_group");
    
                    entity.Property(e => e.BusinessDuration)
                        .HasColumnName("business_duration")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.BusinessImpact).HasColumnName("business_impact");
    
                    entity.Property(e => e.BusinessService).HasColumnName("business_service");
    
                    entity.Property(e => e.BusinessStc)
                        .HasColumnName("business_stc")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.CalendarDuration)
                        .HasColumnName("calendar_duration")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.CalendarStc)
                        .HasColumnName("calendar_stc")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.CallerId).HasColumnName("caller_id");
    
                    entity.Property(e => e.Category).HasColumnName("category");
    
                    entity.Property(e => e.Cause).HasColumnName("cause");
    
                    entity.Property(e => e.CausedBy).HasColumnName("caused_by");
    
                    entity.Property(e => e.ChildIncidents).HasColumnName("child_incidents");
    
                    entity.Property(e => e.CloseCode).HasColumnName("close_code");
    
                    entity.Property(e => e.CloseNotes).HasColumnName("close_notes");
    
                    entity.Property(e => e.ClosedAt).HasColumnName("closed_at");
    
                    entity.Property(e => e.ClosedBy).HasColumnName("closed_by");
    
                    entity.Property(e => e.CmdbCi).HasColumnName("cmdb_ci");
    
                    entity.Property(e => e.Comments).HasColumnName("comments");
    
                    entity.Property(e => e.CommentsAndWorkNotes).HasColumnName("comments_and_work_notes");
    
                    entity.Property(e => e.Company).HasColumnName("company");
    
                    entity.Property(e => e.ContactType).HasColumnName("contact_type");
    
                    entity.Property(e => e.Contract).HasColumnName("contract");
    
                    entity.Property(e => e.CorrelationDisplay).HasColumnName("correlation_display");
    
                    entity.Property(e => e.CorrelationId).HasColumnName("correlation_id");
    
                    entity.Property(e => e.DeliveryPlan).HasColumnName("delivery_plan");
    
                    entity.Property(e => e.DeliveryTask).HasColumnName("delivery_task");
    
                    entity.Property(e => e.Description).HasColumnName("description");
    
                    entity.Property(e => e.DueDate).HasColumnName("due_date");
    
                    entity.Property(e => e.Escalation)
                        .HasColumnName("escalation")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.ExpectedStart).HasColumnName("expected_start");
    
                    entity.Property(e => e.FollowUp).HasColumnName("follow_up");
    
                    entity.Property(e => e.GroupList).HasColumnName("group_list");
    
                    entity.Property(e => e.HoldReason).HasColumnName("hold_reason");
    
                    entity.Property(e => e.Impact).HasColumnName("impact");
    
                    entity.Property(e => e.IncidentState).HasColumnName("incident_state");
    
                    entity.Property(e => e.Knowledge).HasColumnName("knowledge");
    
                    entity.Property(e => e.Location).HasColumnName("location");
    
                    entity.Property(e => e.MadeSla).HasColumnName("made_sla");
    
                    entity.Property(e => e.Notify).HasColumnName("notify");
    
                    entity.Property(e => e.Number).HasColumnName("number");
    
                    entity.Property(e => e.OpenedAt).HasColumnName("opened_at");
    
                    entity.Property(e => e.OpenedBy).HasColumnName("opened_by");
    
                    entity.Property(e => e.Order).HasColumnName("order");
    
                    entity.Property(e => e.OriginId).HasColumnName("origin_id");
    
                    entity.Property(e => e.OriginTable).HasColumnName("origin_table");
    
                    entity.Property(e => e.Parent).HasColumnName("parent");
    
                    entity.Property(e => e.ParentIncident).HasColumnName("parent_incident");
    
                    entity.Property(e => e.Priority).HasColumnName("priority");
    
                    entity.Property(e => e.ProblemId).HasColumnName("problem_id");
    
                    entity.Property(e => e.ReassignmentCount).HasColumnName("reassignment_count");
    
                    entity.Property(e => e.RejectionGoto).HasColumnName("rejection_goto");
    
                    entity.Property(e => e.ReopenCount).HasColumnName("reopen_count");
    
                    entity.Property(e => e.ReopenedBy)
                        .HasColumnName("reopened_by")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.ReopenedTime)
                        .HasColumnName("reopened_time")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.ResolvedAt).HasColumnName("resolved_at");
    
                    entity.Property(e => e.ResolvedBy).HasColumnName("resolved_by");
    
                    entity.Property(e => e.Rfc).HasColumnName("rfc");
    
                    entity.Property(e => e.RouteReason)
                        .HasColumnName("route_reason")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.ServiceOffering).HasColumnName("service_offering");
    
                    entity.Property(e => e.Severity).HasColumnName("severity");
    
                    entity.Property(e => e.ShortDescription).HasColumnName("short_description");
    
                    entity.Property(e => e.SlaDue).HasColumnName("sla_due");
    
                    entity.Property(e => e.State).HasColumnName("state");
    
                    entity.Property(e => e.Subcategory).HasColumnName("subcategory");
    
                    entity.Property(e => e.SysClassName).HasColumnName("sys_class_name");
    
                    entity.Property(e => e.SysCreatedBy).HasColumnName("sys_created_by");
    
                    entity.Property(e => e.SysCreatedOn).HasColumnName("sys_created_on");
    
                    entity.Property(e => e.SysDomain).HasColumnName("sys_domain");
    
                    entity.Property(e => e.SysDomainPath).HasColumnName("sys_domain_path");
    
                    entity.Property(e => e.SysModCount).HasColumnName("sys_mod_count");
    
                    entity.Property(e => e.SysUpdatedBy).HasColumnName("sys_updated_by");
    
                    entity.Property(e => e.SysUpdatedOn).HasColumnName("sys_updated_on");
    
                    entity.Property(e => e.TaskEffectiveNumber)
                        .HasColumnName("task_effective_number")
                        .ValueGeneratedOnAddOrUpdate();
    
                    entity.Property(e => e.TimeWorked).HasColumnName("time_worked");
    
                    entity.Property(e => e.UniversalRequest).HasColumnName("universal_request");
    
                    entity.Property(e => e.UponApproval).HasColumnName("upon_approval");
    
                    entity.Property(e => e.UponReject).HasColumnName("upon_reject");
    
                    entity.Property(e => e.Urgency).HasColumnName("urgency");
    
                    entity.Property(e => e.UserInput).HasColumnName("user_input");
    
                    entity.Property(e => e.Variables).HasColumnName("variables");
    
                    entity.Property(e => e.WatchList).HasColumnName("watch_list");
    
                    entity.Property(e => e.WfActivity).HasColumnName("wf_activity");
    
                    entity.Property(e => e.WorkEnd).HasColumnName("work_end");
    
                    entity.Property(e => e.WorkNotes).HasColumnName("work_notes");
    
                    entity.Property(e => e.WorkNotesList).HasColumnName("work_notes_list");
    
                    entity.Property(e => e.WorkStart).HasColumnName("work_start");
                });
    
                OnModelCreatingPartial(modelBuilder);
            }
    
            partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
        }
    }