diff --git a/1-Aquiis.Infrastructure/Aquiis.Infrastructure.csproj b/1-Aquiis.Infrastructure/Aquiis.Infrastructure.csproj index 3653bfa..db530b9 100644 --- a/1-Aquiis.Infrastructure/Aquiis.Infrastructure.csproj +++ b/1-Aquiis.Infrastructure/Aquiis.Infrastructure.csproj @@ -19,6 +19,7 @@ + diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextAssemblyAttributes.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextAssemblyAttributes.cs new file mode 100644 index 0000000..60232d2 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Aquiis.Infrastructure.Data; +using Aquiis.Infrastructure.Data.CompiledModels; +using Microsoft.EntityFrameworkCore.Infrastructure; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(ApplicationDbContext), typeof(ApplicationDbContextModel))] diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextModel.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextModel.cs new file mode 100644 index 0000000..13e8f69 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextModel.cs @@ -0,0 +1,47 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [DbContext(typeof(ApplicationDbContext))] + public partial class ApplicationDbContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static ApplicationDbContextModel() + { + var model = new ApplicationDbContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (ApplicationDbContextModel)model.FinalizeModel(); + } + + private static ApplicationDbContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextModelBuilder.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextModelBuilder.cs new file mode 100644 index 0000000..cfadf32 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationDbContextModelBuilder.cs @@ -0,0 +1,150 @@ +// +using System; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + public partial class ApplicationDbContextModel + { + private ApplicationDbContextModel() + : base(skipDetectChanges: false, modelId: new Guid("409a29cb-f330-41bb-8099-305ed7a81084"), entityTypeCount: 35) + { + } + + partial void Initialize() + { + var applicationScreening = ApplicationScreeningEntityType.Create(this); + var calendarEvent = CalendarEventEntityType.Create(this); + var calendarSettings = CalendarSettingsEntityType.Create(this); + var checklist = ChecklistEntityType.Create(this); + var checklistItem = ChecklistItemEntityType.Create(this); + var checklistTemplate = ChecklistTemplateEntityType.Create(this); + var checklistTemplateItem = ChecklistTemplateItemEntityType.Create(this); + var databaseSettings = DatabaseSettingsEntityType.Create(this); + var document = DocumentEntityType.Create(this); + var inspection = InspectionEntityType.Create(this); + var invoice = InvoiceEntityType.Create(this); + var lease = LeaseEntityType.Create(this); + var leaseOffer = LeaseOfferEntityType.Create(this); + var maintenanceRequest = MaintenanceRequestEntityType.Create(this); + var note = NoteEntityType.Create(this); + var notificationPreferences = NotificationPreferencesEntityType.Create(this); + var organization = OrganizationEntityType.Create(this); + var organizationEmailSettings = OrganizationEmailSettingsEntityType.Create(this); + var organizationSMSSettings = OrganizationSMSSettingsEntityType.Create(this); + var organizationSettings = OrganizationSettingsEntityType.Create(this); + var organizationUser = OrganizationUserEntityType.Create(this); + var payment = PaymentEntityType.Create(this); + var property = PropertyEntityType.Create(this); + var prospectiveTenant = ProspectiveTenantEntityType.Create(this); + var rentalApplication = RentalApplicationEntityType.Create(this); + var repair = RepairEntityType.Create(this); + var schemaVersion = SchemaVersionEntityType.Create(this); + var securityDeposit = SecurityDepositEntityType.Create(this); + var securityDepositDividend = SecurityDepositDividendEntityType.Create(this); + var securityDepositInvestmentPool = SecurityDepositInvestmentPoolEntityType.Create(this); + var tenant = TenantEntityType.Create(this); + var tour = TourEntityType.Create(this); + var userProfile = UserProfileEntityType.Create(this); + var workflowAuditLog = WorkflowAuditLogEntityType.Create(this); + var notification = NotificationEntityType.Create(this); + + ApplicationScreeningEntityType.CreateForeignKey1(applicationScreening, rentalApplication); + CalendarEventEntityType.CreateForeignKey1(calendarEvent, property); + ChecklistEntityType.CreateForeignKey1(checklist, checklistTemplate); + ChecklistEntityType.CreateForeignKey2(checklist, document); + ChecklistEntityType.CreateForeignKey3(checklist, lease); + ChecklistEntityType.CreateForeignKey4(checklist, property); + ChecklistItemEntityType.CreateForeignKey1(checklistItem, checklist); + ChecklistTemplateItemEntityType.CreateForeignKey1(checklistTemplateItem, checklistTemplate); + DocumentEntityType.CreateForeignKey1(document, invoice); + DocumentEntityType.CreateForeignKey2(document, lease); + DocumentEntityType.CreateForeignKey3(document, organization); + DocumentEntityType.CreateForeignKey4(document, payment); + DocumentEntityType.CreateForeignKey5(document, property); + DocumentEntityType.CreateForeignKey6(document, tenant); + InspectionEntityType.CreateForeignKey1(inspection, document); + InspectionEntityType.CreateForeignKey2(inspection, lease); + InspectionEntityType.CreateForeignKey3(inspection, property); + InvoiceEntityType.CreateForeignKey1(invoice, document); + InvoiceEntityType.CreateForeignKey2(invoice, lease); + InvoiceEntityType.CreateForeignKey3(invoice, organization); + LeaseEntityType.CreateForeignKey1(lease, document); + LeaseEntityType.CreateForeignKey2(lease, organization); + LeaseEntityType.CreateForeignKey3(lease, property); + LeaseEntityType.CreateForeignKey4(lease, tenant); + LeaseOfferEntityType.CreateForeignKey1(leaseOffer, property); + LeaseOfferEntityType.CreateForeignKey2(leaseOffer, prospectiveTenant); + LeaseOfferEntityType.CreateForeignKey3(leaseOffer, rentalApplication); + MaintenanceRequestEntityType.CreateForeignKey1(maintenanceRequest, lease); + MaintenanceRequestEntityType.CreateForeignKey2(maintenanceRequest, property); + NotificationPreferencesEntityType.CreateForeignKey1(notificationPreferences, organization); + OrganizationEmailSettingsEntityType.CreateForeignKey1(organizationEmailSettings, organization); + OrganizationSMSSettingsEntityType.CreateForeignKey1(organizationSMSSettings, organization); + OrganizationUserEntityType.CreateForeignKey1(organizationUser, organization); + PaymentEntityType.CreateForeignKey1(payment, document); + PaymentEntityType.CreateForeignKey2(payment, invoice); + PaymentEntityType.CreateForeignKey3(payment, organization); + PropertyEntityType.CreateForeignKey1(property, organization); + ProspectiveTenantEntityType.CreateForeignKey1(prospectiveTenant, property); + RentalApplicationEntityType.CreateForeignKey1(rentalApplication, property); + RentalApplicationEntityType.CreateForeignKey2(rentalApplication, prospectiveTenant); + RepairEntityType.CreateForeignKey1(repair, lease); + RepairEntityType.CreateForeignKey2(repair, maintenanceRequest); + RepairEntityType.CreateForeignKey3(repair, property); + SecurityDepositEntityType.CreateForeignKey1(securityDeposit, lease); + SecurityDepositEntityType.CreateForeignKey2(securityDeposit, tenant); + SecurityDepositDividendEntityType.CreateForeignKey1(securityDepositDividend, securityDepositInvestmentPool); + SecurityDepositDividendEntityType.CreateForeignKey2(securityDepositDividend, lease); + SecurityDepositDividendEntityType.CreateForeignKey3(securityDepositDividend, securityDeposit); + SecurityDepositDividendEntityType.CreateForeignKey4(securityDepositDividend, tenant); + TenantEntityType.CreateForeignKey1(tenant, organization); + TourEntityType.CreateForeignKey1(tour, checklist); + TourEntityType.CreateForeignKey2(tour, property); + TourEntityType.CreateForeignKey3(tour, prospectiveTenant); + NotificationEntityType.CreateForeignKey1(notification, organization); + + ApplicationScreeningEntityType.CreateAnnotations(applicationScreening); + CalendarEventEntityType.CreateAnnotations(calendarEvent); + CalendarSettingsEntityType.CreateAnnotations(calendarSettings); + ChecklistEntityType.CreateAnnotations(checklist); + ChecklistItemEntityType.CreateAnnotations(checklistItem); + ChecklistTemplateEntityType.CreateAnnotations(checklistTemplate); + ChecklistTemplateItemEntityType.CreateAnnotations(checklistTemplateItem); + DatabaseSettingsEntityType.CreateAnnotations(databaseSettings); + DocumentEntityType.CreateAnnotations(document); + InspectionEntityType.CreateAnnotations(inspection); + InvoiceEntityType.CreateAnnotations(invoice); + LeaseEntityType.CreateAnnotations(lease); + LeaseOfferEntityType.CreateAnnotations(leaseOffer); + MaintenanceRequestEntityType.CreateAnnotations(maintenanceRequest); + NoteEntityType.CreateAnnotations(note); + NotificationPreferencesEntityType.CreateAnnotations(notificationPreferences); + OrganizationEntityType.CreateAnnotations(organization); + OrganizationEmailSettingsEntityType.CreateAnnotations(organizationEmailSettings); + OrganizationSMSSettingsEntityType.CreateAnnotations(organizationSMSSettings); + OrganizationSettingsEntityType.CreateAnnotations(organizationSettings); + OrganizationUserEntityType.CreateAnnotations(organizationUser); + PaymentEntityType.CreateAnnotations(payment); + PropertyEntityType.CreateAnnotations(property); + ProspectiveTenantEntityType.CreateAnnotations(prospectiveTenant); + RentalApplicationEntityType.CreateAnnotations(rentalApplication); + RepairEntityType.CreateAnnotations(repair); + SchemaVersionEntityType.CreateAnnotations(schemaVersion); + SecurityDepositEntityType.CreateAnnotations(securityDeposit); + SecurityDepositDividendEntityType.CreateAnnotations(securityDepositDividend); + SecurityDepositInvestmentPoolEntityType.CreateAnnotations(securityDepositInvestmentPool); + TenantEntityType.CreateAnnotations(tenant); + TourEntityType.CreateAnnotations(tour); + UserProfileEntityType.CreateAnnotations(userProfile); + WorkflowAuditLogEntityType.CreateAnnotations(workflowAuditLog); + NotificationEntityType.CreateAnnotations(notification); + + AddAnnotation("ProductVersion", "10.0.1"); + } + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationScreeningEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationScreeningEntityType.cs new file mode 100644 index 0000000..3e57e02 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ApplicationScreeningEntityType.cs @@ -0,0 +1,245 @@ +// +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ApplicationScreeningEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.ApplicationScreening", + typeof(ApplicationScreening), + baseEntityType, + propertyCount: 22, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var backgroundCheckCompletedOn = runtimeEntityType.AddProperty( + "BackgroundCheckCompletedOn", + typeof(DateTime?), + propertyInfo: typeof(ApplicationScreening).GetProperty("BackgroundCheckCompletedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var backgroundCheckNotes = runtimeEntityType.AddProperty( + "BackgroundCheckNotes", + typeof(string), + propertyInfo: typeof(ApplicationScreening).GetProperty("BackgroundCheckNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var backgroundCheckPassed = runtimeEntityType.AddProperty( + "BackgroundCheckPassed", + typeof(bool?), + propertyInfo: typeof(ApplicationScreening).GetProperty("BackgroundCheckPassed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var backgroundCheckRequested = runtimeEntityType.AddProperty( + "BackgroundCheckRequested", + typeof(bool), + propertyInfo: typeof(ApplicationScreening).GetProperty("BackgroundCheckRequested", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var backgroundCheckRequestedOn = runtimeEntityType.AddProperty( + "BackgroundCheckRequestedOn", + typeof(DateTime?), + propertyInfo: typeof(ApplicationScreening).GetProperty("BackgroundCheckRequestedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var creditCheckCompletedOn = runtimeEntityType.AddProperty( + "CreditCheckCompletedOn", + typeof(DateTime?), + propertyInfo: typeof(ApplicationScreening).GetProperty("CreditCheckCompletedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var creditCheckNotes = runtimeEntityType.AddProperty( + "CreditCheckNotes", + typeof(string), + propertyInfo: typeof(ApplicationScreening).GetProperty("CreditCheckNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var creditCheckPassed = runtimeEntityType.AddProperty( + "CreditCheckPassed", + typeof(bool?), + propertyInfo: typeof(ApplicationScreening).GetProperty("CreditCheckPassed", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var creditCheckRequested = runtimeEntityType.AddProperty( + "CreditCheckRequested", + typeof(bool), + propertyInfo: typeof(ApplicationScreening).GetProperty("CreditCheckRequested", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var creditCheckRequestedOn = runtimeEntityType.AddProperty( + "CreditCheckRequestedOn", + typeof(DateTime?), + propertyInfo: typeof(ApplicationScreening).GetProperty("CreditCheckRequestedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var creditScore = runtimeEntityType.AddProperty( + "CreditScore", + typeof(int?), + propertyInfo: typeof(ApplicationScreening).GetProperty("CreditScore", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var overallResult = runtimeEntityType.AddProperty( + "OverallResult", + typeof(string), + propertyInfo: typeof(ApplicationScreening).GetProperty("OverallResult", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var rentalApplicationId = runtimeEntityType.AddProperty( + "RentalApplicationId", + typeof(Guid), + propertyInfo: typeof(ApplicationScreening).GetProperty("RentalApplicationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var resultNotes = runtimeEntityType.AddProperty( + "ResultNotes", + typeof(string), + propertyInfo: typeof(ApplicationScreening).GetProperty("ResultNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { overallResult }); + + var index1 = runtimeEntityType.AddIndex( + new[] { rentalApplicationId }, + unique: true); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RentalApplicationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + unique: true, + required: true); + + var rentalApplication = declaringEntityType.AddNavigation("RentalApplication", + runtimeForeignKey, + onDependent: true, + typeof(RentalApplication), + propertyInfo: typeof(ApplicationScreening).GetProperty("RentalApplication", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ApplicationScreening).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var screening = principalEntityType.AddNavigation("Screening", + runtimeForeignKey, + onDependent: false, + typeof(ApplicationScreening), + propertyInfo: typeof(RentalApplication).GetProperty("Screening", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ApplicationScreenings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/CalendarEventEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/CalendarEventEntityType.cs new file mode 100644 index 0000000..c00abc0 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/CalendarEventEntityType.cs @@ -0,0 +1,237 @@ +// +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class CalendarEventEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.CalendarEvent", + typeof(CalendarEvent), + baseEntityType, + propertyCount: 21, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 6, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var color = runtimeEntityType.AddProperty( + "Color", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("Color", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var durationMinutes = runtimeEntityType.AddProperty( + "DurationMinutes", + typeof(int), + propertyInfo: typeof(CalendarEvent).GetProperty("DurationMinutes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var endOn = runtimeEntityType.AddProperty( + "EndOn", + typeof(DateTime?), + propertyInfo: typeof(CalendarEvent).GetProperty("EndOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var eventType = runtimeEntityType.AddProperty( + "EventType", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("EventType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var icon = runtimeEntityType.AddProperty( + "Icon", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("Icon", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var location = runtimeEntityType.AddProperty( + "Location", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("Location", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid?), + propertyInfo: typeof(CalendarEvent).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var sourceEntityId = runtimeEntityType.AddProperty( + "SourceEntityId", + typeof(Guid?), + propertyInfo: typeof(CalendarEvent).GetProperty("SourceEntityId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var sourceEntityType = runtimeEntityType.AddProperty( + "SourceEntityType", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("SourceEntityType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var startOn = runtimeEntityType.AddProperty( + "StartOn", + typeof(DateTime), + propertyInfo: typeof(CalendarEvent).GetProperty("StartOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var title = runtimeEntityType.AddProperty( + "Title", + typeof(string), + propertyInfo: typeof(CalendarEvent).GetProperty("Title", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { eventType }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { sourceEntityId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { startOn }); + + var index4 = runtimeEntityType.AddIndex( + new[] { sourceEntityType, sourceEntityId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(CalendarEvent).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarEvent).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "CalendarEvents"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/CalendarSettingsEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/CalendarSettingsEntityType.cs new file mode 100644 index 0000000..05cbde6 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/CalendarSettingsEntityType.cs @@ -0,0 +1,153 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class CalendarSettingsEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.CalendarSettings", + typeof(CalendarSettings), + baseEntityType, + propertyCount: 14, + unnamedIndexCount: 2, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var autoCreateEvents = runtimeEntityType.AddProperty( + "AutoCreateEvents", + typeof(bool), + propertyInfo: typeof(CalendarSettings).GetProperty("AutoCreateEvents", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarSettings).GetField("<AutoCreateEvents>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var defaultColor = runtimeEntityType.AddProperty( + "DefaultColor", + typeof(string), + propertyInfo: typeof(CalendarSettings).GetProperty("DefaultColor", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarSettings).GetField("<DefaultColor>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var defaultIcon = runtimeEntityType.AddProperty( + "DefaultIcon", + typeof(string), + propertyInfo: typeof(CalendarSettings).GetProperty("DefaultIcon", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarSettings).GetField("<DefaultIcon>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var displayOrder = runtimeEntityType.AddProperty( + "DisplayOrder", + typeof(int), + propertyInfo: typeof(CalendarSettings).GetProperty("DisplayOrder", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarSettings).GetField("<DisplayOrder>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var entityType = runtimeEntityType.AddProperty( + "EntityType", + typeof(string), + propertyInfo: typeof(CalendarSettings).GetProperty("EntityType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarSettings).GetField("<EntityType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var showOnCalendar = runtimeEntityType.AddProperty( + "ShowOnCalendar", + typeof(bool), + propertyInfo: typeof(CalendarSettings).GetProperty("ShowOnCalendar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(CalendarSettings).GetField("<ShowOnCalendar>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId, entityType }, + unique: true); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "CalendarSettings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistEntityType.cs new file mode 100644 index 0000000..799bbe5 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistEntityType.cs @@ -0,0 +1,278 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ChecklistEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Checklist", + typeof(Checklist), + baseEntityType, + propertyCount: 18, + navigationCount: 5, + foreignKeyCount: 4, + unnamedIndexCount: 7, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var checklistTemplateId = runtimeEntityType.AddProperty( + "ChecklistTemplateId", + typeof(Guid), + propertyInfo: typeof(Checklist).GetProperty("ChecklistTemplateId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<ChecklistTemplateId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var checklistType = runtimeEntityType.AddProperty( + "ChecklistType", + typeof(string), + propertyInfo: typeof(Checklist).GetProperty("ChecklistType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<ChecklistType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var completedBy = runtimeEntityType.AddProperty( + "CompletedBy", + typeof(string), + propertyInfo: typeof(Checklist).GetProperty("CompletedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<CompletedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var completedOn = runtimeEntityType.AddProperty( + "CompletedOn", + typeof(DateTime?), + propertyInfo: typeof(Checklist).GetProperty("CompletedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<CompletedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var documentId = runtimeEntityType.AddProperty( + "DocumentId", + typeof(Guid?), + propertyInfo: typeof(Checklist).GetProperty("DocumentId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<DocumentId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var generalNotes = runtimeEntityType.AddProperty( + "GeneralNotes", + typeof(string), + propertyInfo: typeof(Checklist).GetProperty("GeneralNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<GeneralNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid?), + propertyInfo: typeof(Checklist).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Checklist).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid?), + propertyInfo: typeof(Checklist).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(Checklist).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { checklistTemplateId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { checklistType }); + + var index1 = runtimeEntityType.AddIndex( + new[] { completedOn }); + + var index2 = runtimeEntityType.AddIndex( + new[] { documentId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { leaseId }); + + var index4 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index5 = runtimeEntityType.AddIndex( + new[] { status }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ChecklistTemplateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var checklistTemplate = declaringEntityType.AddNavigation("ChecklistTemplate", + runtimeForeignKey, + onDependent: true, + typeof(ChecklistTemplate), + propertyInfo: typeof(Checklist).GetProperty("ChecklistTemplate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<ChecklistTemplate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var checklists = principalEntityType.AddNavigation("Checklists", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Checklist>), + propertyInfo: typeof(ChecklistTemplate).GetProperty("Checklists", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplate).GetField("<Checklists>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DocumentId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var document = declaringEntityType.AddNavigation("Document", + runtimeForeignKey, + onDependent: true, + typeof(Document), + propertyInfo: typeof(Checklist).GetProperty("Document", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<Document>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(Checklist).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey4(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(Checklist).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Checklists"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistItemEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistItemEntityType.cs new file mode 100644 index 0000000..4686a6a --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistItemEntityType.cs @@ -0,0 +1,211 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ChecklistItemEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.ChecklistItem", + typeof(ChecklistItem), + baseEntityType, + propertyCount: 18, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var categorySection = runtimeEntityType.AddProperty( + "CategorySection", + typeof(string), + propertyInfo: typeof(ChecklistItem).GetProperty("CategorySection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<CategorySection>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var checklistId = runtimeEntityType.AddProperty( + "ChecklistId", + typeof(Guid), + propertyInfo: typeof(ChecklistItem).GetProperty("ChecklistId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<ChecklistId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var isChecked = runtimeEntityType.AddProperty( + "IsChecked", + typeof(bool), + propertyInfo: typeof(ChecklistItem).GetProperty("IsChecked", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<IsChecked>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var itemOrder = runtimeEntityType.AddProperty( + "ItemOrder", + typeof(int), + propertyInfo: typeof(ChecklistItem).GetProperty("ItemOrder", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<ItemOrder>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var itemText = runtimeEntityType.AddProperty( + "ItemText", + typeof(string), + propertyInfo: typeof(ChecklistItem).GetProperty("ItemText", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<ItemText>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(ChecklistItem).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var photoUrl = runtimeEntityType.AddProperty( + "PhotoUrl", + typeof(string), + propertyInfo: typeof(ChecklistItem).GetProperty("PhotoUrl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<PhotoUrl>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var requiresValue = runtimeEntityType.AddProperty( + "RequiresValue", + typeof(bool), + propertyInfo: typeof(ChecklistItem).GetProperty("RequiresValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<RequiresValue>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sectionOrder = runtimeEntityType.AddProperty( + "SectionOrder", + typeof(int), + propertyInfo: typeof(ChecklistItem).GetProperty("SectionOrder", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<SectionOrder>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var value = runtimeEntityType.AddProperty( + "Value", + typeof(string), + propertyInfo: typeof(ChecklistItem).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<Value>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { checklistId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ChecklistId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var checklist = declaringEntityType.AddNavigation("Checklist", + runtimeForeignKey, + onDependent: true, + typeof(Checklist), + propertyInfo: typeof(ChecklistItem).GetProperty("Checklist", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistItem).GetField("<Checklist>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var items = principalEntityType.AddNavigation("Items", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<ChecklistItem>), + propertyInfo: typeof(Checklist).GetProperty("Items", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Checklist).GetField("<Items>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ChecklistItems"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistTemplateEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistTemplateEntityType.cs new file mode 100644 index 0000000..098bb07 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistTemplateEntityType.cs @@ -0,0 +1,141 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ChecklistTemplateEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.ChecklistTemplate", + typeof(ChecklistTemplate), + baseEntityType, + propertyCount: 12, + navigationCount: 2, + unnamedIndexCount: 2, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var category = runtimeEntityType.AddProperty( + "Category", + typeof(string), + propertyInfo: typeof(ChecklistTemplate).GetProperty("Category", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplate).GetField("<Category>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(ChecklistTemplate).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplate).GetField("<Description>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSystemTemplate = runtimeEntityType.AddProperty( + "IsSystemTemplate", + typeof(bool), + propertyInfo: typeof(ChecklistTemplate).GetProperty("IsSystemTemplate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplate).GetField("<IsSystemTemplate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(ChecklistTemplate).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplate).GetField("<Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { category }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ChecklistTemplates"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistTemplateItemEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistTemplateItemEntityType.cs new file mode 100644 index 0000000..4f3fc0b --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ChecklistTemplateItemEntityType.cs @@ -0,0 +1,194 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ChecklistTemplateItemEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.ChecklistTemplateItem", + typeof(ChecklistTemplateItem), + baseEntityType, + propertyCount: 16, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var allowsNotes = runtimeEntityType.AddProperty( + "AllowsNotes", + typeof(bool), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("AllowsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<AllowsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var categorySection = runtimeEntityType.AddProperty( + "CategorySection", + typeof(string), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("CategorySection", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<CategorySection>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var checklistTemplateId = runtimeEntityType.AddProperty( + "ChecklistTemplateId", + typeof(Guid), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("ChecklistTemplateId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<ChecklistTemplateId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isRequired = runtimeEntityType.AddProperty( + "IsRequired", + typeof(bool), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("IsRequired", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<IsRequired>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var itemOrder = runtimeEntityType.AddProperty( + "ItemOrder", + typeof(int), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("ItemOrder", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<ItemOrder>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var itemText = runtimeEntityType.AddProperty( + "ItemText", + typeof(string), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("ItemText", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<ItemText>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var requiresValue = runtimeEntityType.AddProperty( + "RequiresValue", + typeof(bool), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("RequiresValue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<RequiresValue>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sectionOrder = runtimeEntityType.AddProperty( + "SectionOrder", + typeof(int), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("SectionOrder", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<SectionOrder>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { checklistTemplateId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ChecklistTemplateId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var checklistTemplate = declaringEntityType.AddNavigation("ChecklistTemplate", + runtimeForeignKey, + onDependent: true, + typeof(ChecklistTemplate), + propertyInfo: typeof(ChecklistTemplateItem).GetProperty("ChecklistTemplate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplateItem).GetField("<ChecklistTemplate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var items = principalEntityType.AddNavigation("Items", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<ChecklistTemplateItem>), + propertyInfo: typeof(ChecklistTemplate).GetProperty("Items", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ChecklistTemplate).GetField("<Items>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ChecklistTemplateItems"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/DatabaseSettingsEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/DatabaseSettingsEntityType.cs new file mode 100644 index 0000000..b4161c7 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/DatabaseSettingsEntityType.cs @@ -0,0 +1,91 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class DatabaseSettingsEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.DatabaseSettings", + typeof(DatabaseSettings), + baseEntityType, + propertyCount: 6, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(DatabaseSettings).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DatabaseSettings).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + + var databaseEncryptionEnabled = runtimeEntityType.AddProperty( + "DatabaseEncryptionEnabled", + typeof(bool), + propertyInfo: typeof(DatabaseSettings).GetProperty("DatabaseEncryptionEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DatabaseSettings).GetField("<DatabaseEncryptionEnabled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var encryptionChangedOn = runtimeEntityType.AddProperty( + "EncryptionChangedOn", + typeof(DateTime?), + propertyInfo: typeof(DatabaseSettings).GetProperty("EncryptionChangedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DatabaseSettings).GetField("<EncryptionChangedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var encryptionSalt = runtimeEntityType.AddProperty( + "EncryptionSalt", + typeof(string), + propertyInfo: typeof(DatabaseSettings).GetProperty("EncryptionSalt", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DatabaseSettings).GetField("<EncryptionSalt>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 256); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(DatabaseSettings).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DatabaseSettings).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 128); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime), + propertyInfo: typeof(DatabaseSettings).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(DatabaseSettings).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "DatabaseSettings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/DocumentEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/DocumentEntityType.cs new file mode 100644 index 0000000..72610d1 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/DocumentEntityType.cs @@ -0,0 +1,334 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class DocumentEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Document", + typeof(Document), + baseEntityType, + propertyCount: 22, + navigationCount: 5, + foreignKeyCount: 6, + unnamedIndexCount: 6, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var contentType = runtimeEntityType.AddProperty( + "ContentType", + typeof(string), + propertyInfo: typeof(Document).GetProperty("ContentType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<ContentType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(Document).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<Description>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var documentType = runtimeEntityType.AddProperty( + "DocumentType", + typeof(string), + propertyInfo: typeof(Document).GetProperty("DocumentType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<DocumentType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var fileData = runtimeEntityType.AddProperty( + "FileData", + typeof(byte[]), + propertyInfo: typeof(Document).GetProperty("FileData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<FileData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var fileExtension = runtimeEntityType.AddProperty( + "FileExtension", + typeof(string), + propertyInfo: typeof(Document).GetProperty("FileExtension", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<FileExtension>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 10); + + var fileName = runtimeEntityType.AddProperty( + "FileName", + typeof(string), + propertyInfo: typeof(Document).GetProperty("FileName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<FileName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 255); + + var filePath = runtimeEntityType.AddProperty( + "FilePath", + typeof(string), + propertyInfo: typeof(Document).GetProperty("FilePath", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<FilePath>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 255); + + var fileSize = runtimeEntityType.AddProperty( + "FileSize", + typeof(long), + propertyInfo: typeof(Document).GetProperty("FileSize", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<FileSize>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0L); + + var fileType = runtimeEntityType.AddProperty( + "FileType", + typeof(string), + propertyInfo: typeof(Document).GetProperty("FileType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<FileType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var invoiceId = runtimeEntityType.AddProperty( + "InvoiceId", + typeof(Guid?), + propertyInfo: typeof(Document).GetProperty("InvoiceId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<InvoiceId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid?), + propertyInfo: typeof(Document).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var paymentId = runtimeEntityType.AddProperty( + "PaymentId", + typeof(Guid?), + propertyInfo: typeof(Document).GetProperty("PaymentId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<PaymentId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid?), + propertyInfo: typeof(Document).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var tenantId = runtimeEntityType.AddProperty( + "TenantId", + typeof(Guid?), + propertyInfo: typeof(Document).GetProperty("TenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<TenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { invoiceId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { leaseId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { paymentId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index4 = runtimeEntityType.AddIndex( + new[] { tenantId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("InvoiceId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var invoice = declaringEntityType.AddNavigation("Invoice", + runtimeForeignKey, + onDependent: true, + typeof(Invoice), + propertyInfo: typeof(Document).GetProperty("Invoice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<Invoice>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(Document).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var documents = principalEntityType.AddNavigation("Documents", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Document>), + propertyInfo: typeof(Lease).GetProperty("Documents", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Documents>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey4(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PaymentId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var payment = declaringEntityType.AddNavigation("Payment", + runtimeForeignKey, + onDependent: true, + typeof(Payment), + propertyInfo: typeof(Document).GetProperty("Payment", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<Payment>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey5(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(Document).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var documents = principalEntityType.AddNavigation("Documents", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Document>), + propertyInfo: typeof(Property).GetProperty("Documents", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Documents>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey6(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TenantId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var tenant = declaringEntityType.AddNavigation("Tenant", + runtimeForeignKey, + onDependent: true, + typeof(Tenant), + propertyInfo: typeof(Document).GetProperty("Tenant", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Document).GetField("<Tenant>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Documents"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/InspectionEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/InspectionEntityType.cs new file mode 100644 index 0000000..e90bfc0 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/InspectionEntityType.cs @@ -0,0 +1,595 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class InspectionEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Inspection", + typeof(Inspection), + baseEntityType, + propertyCount: 68, + navigationCount: 3, + foreignKeyCount: 3, + unnamedIndexCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var actionItemsRequired = runtimeEntityType.AddProperty( + "ActionItemsRequired", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ActionItemsRequired", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ActionItemsRequired>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var bathroomSinkGood = runtimeEntityType.AddProperty( + "BathroomSinkGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("BathroomSinkGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomSinkGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var bathroomSinkNotes = runtimeEntityType.AddProperty( + "BathroomSinkNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("BathroomSinkNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomSinkNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var bathroomToiletGood = runtimeEntityType.AddProperty( + "BathroomToiletGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("BathroomToiletGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomToiletGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var bathroomToiletNotes = runtimeEntityType.AddProperty( + "BathroomToiletNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("BathroomToiletNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomToiletNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var bathroomTubShowerGood = runtimeEntityType.AddProperty( + "BathroomTubShowerGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("BathroomTubShowerGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomTubShowerGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var bathroomTubShowerNotes = runtimeEntityType.AddProperty( + "BathroomTubShowerNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("BathroomTubShowerNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomTubShowerNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var bathroomVentilationGood = runtimeEntityType.AddProperty( + "BathroomVentilationGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("BathroomVentilationGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomVentilationGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var bathroomVentilationNotes = runtimeEntityType.AddProperty( + "BathroomVentilationNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("BathroomVentilationNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<BathroomVentilationNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var calendarEventId = runtimeEntityType.AddProperty( + "CalendarEventId", + typeof(Guid?), + propertyInfo: typeof(Inspection).GetProperty("CalendarEventId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<CalendarEventId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var carbonMonoxideDetectorsGood = runtimeEntityType.AddProperty( + "CarbonMonoxideDetectorsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("CarbonMonoxideDetectorsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<CarbonMonoxideDetectorsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var carbonMonoxideDetectorsNotes = runtimeEntityType.AddProperty( + "CarbonMonoxideDetectorsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("CarbonMonoxideDetectorsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<CarbonMonoxideDetectorsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var completedOn = runtimeEntityType.AddProperty( + "CompletedOn", + typeof(DateTime), + propertyInfo: typeof(Inspection).GetProperty("CompletedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<CompletedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var documentId = runtimeEntityType.AddProperty( + "DocumentId", + typeof(Guid?), + propertyInfo: typeof(Inspection).GetProperty("DocumentId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<DocumentId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var electricalSystemGood = runtimeEntityType.AddProperty( + "ElectricalSystemGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("ElectricalSystemGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ElectricalSystemGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var electricalSystemNotes = runtimeEntityType.AddProperty( + "ElectricalSystemNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ElectricalSystemNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ElectricalSystemNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var exteriorDoorsGood = runtimeEntityType.AddProperty( + "ExteriorDoorsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("ExteriorDoorsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorDoorsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var exteriorDoorsNotes = runtimeEntityType.AddProperty( + "ExteriorDoorsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ExteriorDoorsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorDoorsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var exteriorFoundationGood = runtimeEntityType.AddProperty( + "ExteriorFoundationGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("ExteriorFoundationGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorFoundationGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var exteriorFoundationNotes = runtimeEntityType.AddProperty( + "ExteriorFoundationNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ExteriorFoundationNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorFoundationNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var exteriorGuttersGood = runtimeEntityType.AddProperty( + "ExteriorGuttersGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("ExteriorGuttersGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorGuttersGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var exteriorGuttersNotes = runtimeEntityType.AddProperty( + "ExteriorGuttersNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ExteriorGuttersNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorGuttersNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var exteriorRoofGood = runtimeEntityType.AddProperty( + "ExteriorRoofGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("ExteriorRoofGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorRoofGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var exteriorRoofNotes = runtimeEntityType.AddProperty( + "ExteriorRoofNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ExteriorRoofNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorRoofNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var exteriorSidingGood = runtimeEntityType.AddProperty( + "ExteriorSidingGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("ExteriorSidingGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorSidingGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var exteriorSidingNotes = runtimeEntityType.AddProperty( + "ExteriorSidingNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ExteriorSidingNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorSidingNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var exteriorWindowsGood = runtimeEntityType.AddProperty( + "ExteriorWindowsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("ExteriorWindowsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorWindowsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var exteriorWindowsNotes = runtimeEntityType.AddProperty( + "ExteriorWindowsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("ExteriorWindowsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<ExteriorWindowsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var generalNotes = runtimeEntityType.AddProperty( + "GeneralNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("GeneralNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<GeneralNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var hvacSystemGood = runtimeEntityType.AddProperty( + "HvacSystemGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("HvacSystemGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<HvacSystemGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var hvacSystemNotes = runtimeEntityType.AddProperty( + "HvacSystemNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("HvacSystemNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<HvacSystemNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var inspectedBy = runtimeEntityType.AddProperty( + "InspectedBy", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("InspectedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InspectedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var inspectionType = runtimeEntityType.AddProperty( + "InspectionType", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("InspectionType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InspectionType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var interiorCeilingsGood = runtimeEntityType.AddProperty( + "InteriorCeilingsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("InteriorCeilingsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorCeilingsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var interiorCeilingsNotes = runtimeEntityType.AddProperty( + "InteriorCeilingsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("InteriorCeilingsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorCeilingsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var interiorDoorsGood = runtimeEntityType.AddProperty( + "InteriorDoorsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("InteriorDoorsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorDoorsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var interiorDoorsNotes = runtimeEntityType.AddProperty( + "InteriorDoorsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("InteriorDoorsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorDoorsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var interiorFloorsGood = runtimeEntityType.AddProperty( + "InteriorFloorsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("InteriorFloorsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorFloorsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var interiorFloorsNotes = runtimeEntityType.AddProperty( + "InteriorFloorsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("InteriorFloorsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorFloorsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var interiorWallsGood = runtimeEntityType.AddProperty( + "InteriorWallsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("InteriorWallsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorWallsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var interiorWallsNotes = runtimeEntityType.AddProperty( + "InteriorWallsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("InteriorWallsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorWallsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var interiorWindowsGood = runtimeEntityType.AddProperty( + "InteriorWindowsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("InteriorWindowsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorWindowsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var interiorWindowsNotes = runtimeEntityType.AddProperty( + "InteriorWindowsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("InteriorWindowsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<InteriorWindowsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var kitchenAppliancesGood = runtimeEntityType.AddProperty( + "KitchenAppliancesGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("KitchenAppliancesGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenAppliancesGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var kitchenAppliancesNotes = runtimeEntityType.AddProperty( + "KitchenAppliancesNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("KitchenAppliancesNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenAppliancesNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var kitchenCabinetsGood = runtimeEntityType.AddProperty( + "KitchenCabinetsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("KitchenCabinetsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenCabinetsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var kitchenCabinetsNotes = runtimeEntityType.AddProperty( + "KitchenCabinetsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("KitchenCabinetsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenCabinetsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var kitchenCountersGood = runtimeEntityType.AddProperty( + "KitchenCountersGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("KitchenCountersGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenCountersGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var kitchenCountersNotes = runtimeEntityType.AddProperty( + "KitchenCountersNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("KitchenCountersNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenCountersNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var kitchenSinkPlumbingGood = runtimeEntityType.AddProperty( + "KitchenSinkPlumbingGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("KitchenSinkPlumbingGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenSinkPlumbingGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var kitchenSinkPlumbingNotes = runtimeEntityType.AddProperty( + "KitchenSinkPlumbingNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("KitchenSinkPlumbingNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<KitchenSinkPlumbingNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var landscapingGood = runtimeEntityType.AddProperty( + "LandscapingGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("LandscapingGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<LandscapingGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var landscapingNotes = runtimeEntityType.AddProperty( + "LandscapingNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("LandscapingNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<LandscapingNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid?), + propertyInfo: typeof(Inspection).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var overallCondition = runtimeEntityType.AddProperty( + "OverallCondition", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("OverallCondition", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<OverallCondition>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var plumbingSystemGood = runtimeEntityType.AddProperty( + "PlumbingSystemGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("PlumbingSystemGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<PlumbingSystemGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var plumbingSystemNotes = runtimeEntityType.AddProperty( + "PlumbingSystemNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("PlumbingSystemNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<PlumbingSystemNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(Inspection).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var smokeDetectorsGood = runtimeEntityType.AddProperty( + "SmokeDetectorsGood", + typeof(bool), + propertyInfo: typeof(Inspection).GetProperty("SmokeDetectorsGood", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<SmokeDetectorsGood>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var smokeDetectorsNotes = runtimeEntityType.AddProperty( + "SmokeDetectorsNotes", + typeof(string), + propertyInfo: typeof(Inspection).GetProperty("SmokeDetectorsNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<SmokeDetectorsNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { completedOn }); + + var index0 = runtimeEntityType.AddIndex( + new[] { documentId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { leaseId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DocumentId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var document = declaringEntityType.AddNavigation("Document", + runtimeForeignKey, + onDependent: true, + typeof(Document), + propertyInfo: typeof(Inspection).GetProperty("Document", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<Document>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(Inspection).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(Inspection).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Inspection).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Inspections"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/InvoiceEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/InvoiceEntityType.cs new file mode 100644 index 0000000..20d547e --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/InvoiceEntityType.cs @@ -0,0 +1,292 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class InvoiceEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Invoice", + typeof(Invoice), + baseEntityType, + propertyCount: 24, + navigationCount: 3, + foreignKeyCount: 3, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var amount = runtimeEntityType.AddProperty( + "Amount", + typeof(decimal), + propertyInfo: typeof(Invoice).GetProperty("Amount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<Amount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + amount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var amountPaid = runtimeEntityType.AddProperty( + "AmountPaid", + typeof(decimal), + propertyInfo: typeof(Invoice).GetProperty("AmountPaid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<AmountPaid>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + amountPaid.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(Invoice).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<Description>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var documentId = runtimeEntityType.AddProperty( + "DocumentId", + typeof(Guid?), + propertyInfo: typeof(Invoice).GetProperty("DocumentId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<DocumentId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var dueOn = runtimeEntityType.AddProperty( + "DueOn", + typeof(DateTime), + propertyInfo: typeof(Invoice).GetProperty("DueOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<DueOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var invoiceNumber = runtimeEntityType.AddProperty( + "InvoiceNumber", + typeof(string), + propertyInfo: typeof(Invoice).GetProperty("InvoiceNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<InvoiceNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var invoicedOn = runtimeEntityType.AddProperty( + "InvoicedOn", + typeof(DateTime), + propertyInfo: typeof(Invoice).GetProperty("InvoicedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<InvoicedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lateFeeAmount = runtimeEntityType.AddProperty( + "LateFeeAmount", + typeof(decimal?), + propertyInfo: typeof(Invoice).GetProperty("LateFeeAmount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<LateFeeAmount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + lateFeeAmount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var lateFeeApplied = runtimeEntityType.AddProperty( + "LateFeeApplied", + typeof(bool?), + propertyInfo: typeof(Invoice).GetProperty("LateFeeApplied", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<LateFeeApplied>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lateFeeAppliedOn = runtimeEntityType.AddProperty( + "LateFeeAppliedOn", + typeof(DateTime?), + propertyInfo: typeof(Invoice).GetProperty("LateFeeAppliedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<LateFeeAppliedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid), + propertyInfo: typeof(Invoice).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(Invoice).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var paidOn = runtimeEntityType.AddProperty( + "PaidOn", + typeof(DateTime?), + propertyInfo: typeof(Invoice).GetProperty("PaidOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<PaidOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var reminderSent = runtimeEntityType.AddProperty( + "ReminderSent", + typeof(bool?), + propertyInfo: typeof(Invoice).GetProperty("ReminderSent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<ReminderSent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var reminderSentOn = runtimeEntityType.AddProperty( + "ReminderSentOn", + typeof(DateTime?), + propertyInfo: typeof(Invoice).GetProperty("ReminderSentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<ReminderSentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(Invoice).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { documentId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { leaseId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { organizationId, invoiceNumber }, + unique: true); + index1.AddAnnotation("Relational:Name", "IX_Invoice_OrgId_InvoiceNumber"); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DocumentId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var document = declaringEntityType.AddNavigation("Document", + runtimeForeignKey, + onDependent: true, + typeof(Document), + propertyInfo: typeof(Invoice).GetProperty("Document", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<Document>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(Invoice).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var invoices = principalEntityType.AddNavigation("Invoices", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Invoice>), + propertyInfo: typeof(Lease).GetProperty("Invoices", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Invoices>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Invoices"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/LeaseEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/LeaseEntityType.cs new file mode 100644 index 0000000..0577961 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/LeaseEntityType.cs @@ -0,0 +1,419 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class LeaseEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Lease", + typeof(Lease), + baseEntityType, + propertyCount: 37, + navigationCount: 5, + foreignKeyCount: 4, + unnamedIndexCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var actualMoveOutDate = runtimeEntityType.AddProperty( + "ActualMoveOutDate", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("ActualMoveOutDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<ActualMoveOutDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var declinedOn = runtimeEntityType.AddProperty( + "DeclinedOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("DeclinedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<DeclinedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var documentId = runtimeEntityType.AddProperty( + "DocumentId", + typeof(Guid?), + propertyInfo: typeof(Lease).GetProperty("DocumentId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<DocumentId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var endDate = runtimeEntityType.AddProperty( + "EndDate", + typeof(DateTime), + propertyInfo: typeof(Lease).GetProperty("EndDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<EndDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var expectedMoveOutDate = runtimeEntityType.AddProperty( + "ExpectedMoveOutDate", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("ExpectedMoveOutDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<ExpectedMoveOutDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var expiresOn = runtimeEntityType.AddProperty( + "ExpiresOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("ExpiresOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<ExpiresOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseOfferId = runtimeEntityType.AddProperty( + "LeaseOfferId", + typeof(Guid?), + propertyInfo: typeof(Lease).GetProperty("LeaseOfferId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<LeaseOfferId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var monthlyRent = runtimeEntityType.AddProperty( + "MonthlyRent", + typeof(decimal), + propertyInfo: typeof(Lease).GetProperty("MonthlyRent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<MonthlyRent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + monthlyRent.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(Lease).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var offeredOn = runtimeEntityType.AddProperty( + "OfferedOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("OfferedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<OfferedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var previousLeaseId = runtimeEntityType.AddProperty( + "PreviousLeaseId", + typeof(Guid?), + propertyInfo: typeof(Lease).GetProperty("PreviousLeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<PreviousLeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(Lease).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var proposedRenewalRent = runtimeEntityType.AddProperty( + "ProposedRenewalRent", + typeof(decimal?), + propertyInfo: typeof(Lease).GetProperty("ProposedRenewalRent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<ProposedRenewalRent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + proposedRenewalRent.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var renewalNotes = runtimeEntityType.AddProperty( + "RenewalNotes", + typeof(string), + propertyInfo: typeof(Lease).GetProperty("RenewalNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var renewalNotificationSent = runtimeEntityType.AddProperty( + "RenewalNotificationSent", + typeof(bool?), + propertyInfo: typeof(Lease).GetProperty("RenewalNotificationSent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalNotificationSent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var renewalNotificationSentOn = runtimeEntityType.AddProperty( + "RenewalNotificationSentOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("RenewalNotificationSentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalNotificationSentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var renewalNumber = runtimeEntityType.AddProperty( + "RenewalNumber", + typeof(int), + propertyInfo: typeof(Lease).GetProperty("RenewalNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var renewalOfferedOn = runtimeEntityType.AddProperty( + "RenewalOfferedOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("RenewalOfferedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalOfferedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var renewalReminderSentOn = runtimeEntityType.AddProperty( + "RenewalReminderSentOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("RenewalReminderSentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalReminderSentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var renewalResponseOn = runtimeEntityType.AddProperty( + "RenewalResponseOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("RenewalResponseOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalResponseOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var renewalStatus = runtimeEntityType.AddProperty( + "RenewalStatus", + typeof(string), + propertyInfo: typeof(Lease).GetProperty("RenewalStatus", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<RenewalStatus>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 50); + + var securityDeposit = runtimeEntityType.AddProperty( + "SecurityDeposit", + typeof(decimal), + propertyInfo: typeof(Lease).GetProperty("SecurityDeposit", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<SecurityDeposit>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + securityDeposit.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var signedOn = runtimeEntityType.AddProperty( + "SignedOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("SignedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<SignedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var startDate = runtimeEntityType.AddProperty( + "StartDate", + typeof(DateTime), + propertyInfo: typeof(Lease).GetProperty("StartDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<StartDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(Lease).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var tenantId = runtimeEntityType.AddProperty( + "TenantId", + typeof(Guid), + propertyInfo: typeof(Lease).GetProperty("TenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<TenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var terminationNoticedOn = runtimeEntityType.AddProperty( + "TerminationNoticedOn", + typeof(DateTime?), + propertyInfo: typeof(Lease).GetProperty("TerminationNoticedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<TerminationNoticedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var terminationReason = runtimeEntityType.AddProperty( + "TerminationReason", + typeof(string), + propertyInfo: typeof(Lease).GetProperty("TerminationReason", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<TerminationReason>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var terms = runtimeEntityType.AddProperty( + "Terms", + typeof(string), + propertyInfo: typeof(Lease).GetProperty("Terms", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Terms>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 1000); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { documentId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { tenantId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DocumentId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var document = declaringEntityType.AddNavigation("Document", + runtimeForeignKey, + onDependent: true, + typeof(Document), + propertyInfo: typeof(Lease).GetProperty("Document", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Document>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var leases = principalEntityType.AddNavigation("Leases", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Lease>), + propertyInfo: typeof(Organization).GetProperty("Leases", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<Leases>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(Lease).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var leases = principalEntityType.AddNavigation("Leases", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Lease>), + propertyInfo: typeof(Property).GetProperty("Leases", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Leases>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey4(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TenantId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var tenant = declaringEntityType.AddNavigation("Tenant", + runtimeForeignKey, + onDependent: true, + typeof(Tenant), + propertyInfo: typeof(Lease).GetProperty("Tenant", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Lease).GetField("<Tenant>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var leases = principalEntityType.AddNavigation("Leases", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Lease>), + propertyInfo: typeof(Tenant).GetProperty("Leases", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<Leases>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Leases"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/LeaseOfferEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/LeaseOfferEntityType.cs new file mode 100644 index 0000000..b202dd0 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/LeaseOfferEntityType.cs @@ -0,0 +1,279 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class LeaseOfferEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.LeaseOffer", + typeof(LeaseOffer), + baseEntityType, + propertyCount: 23, + navigationCount: 3, + foreignKeyCount: 3, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var convertedLeaseId = runtimeEntityType.AddProperty( + "ConvertedLeaseId", + typeof(Guid?), + propertyInfo: typeof(LeaseOffer).GetProperty("ConvertedLeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<ConvertedLeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var endDate = runtimeEntityType.AddProperty( + "EndDate", + typeof(DateTime), + propertyInfo: typeof(LeaseOffer).GetProperty("EndDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<EndDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var expiresOn = runtimeEntityType.AddProperty( + "ExpiresOn", + typeof(DateTime), + propertyInfo: typeof(LeaseOffer).GetProperty("ExpiresOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<ExpiresOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var monthlyRent = runtimeEntityType.AddProperty( + "MonthlyRent", + typeof(decimal), + propertyInfo: typeof(LeaseOffer).GetProperty("MonthlyRent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<MonthlyRent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + monthlyRent.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(LeaseOffer).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 1000); + + var offeredOn = runtimeEntityType.AddProperty( + "OfferedOn", + typeof(DateTime), + propertyInfo: typeof(LeaseOffer).GetProperty("OfferedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<OfferedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(LeaseOffer).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var prospectiveTenantId = runtimeEntityType.AddProperty( + "ProspectiveTenantId", + typeof(Guid), + propertyInfo: typeof(LeaseOffer).GetProperty("ProspectiveTenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<ProspectiveTenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var rentalApplicationId = runtimeEntityType.AddProperty( + "RentalApplicationId", + typeof(Guid), + propertyInfo: typeof(LeaseOffer).GetProperty("RentalApplicationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<RentalApplicationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var respondedOn = runtimeEntityType.AddProperty( + "RespondedOn", + typeof(DateTime?), + propertyInfo: typeof(LeaseOffer).GetProperty("RespondedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<RespondedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var responseNotes = runtimeEntityType.AddProperty( + "ResponseNotes", + typeof(string), + propertyInfo: typeof(LeaseOffer).GetProperty("ResponseNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<ResponseNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var securityDeposit = runtimeEntityType.AddProperty( + "SecurityDeposit", + typeof(decimal), + propertyInfo: typeof(LeaseOffer).GetProperty("SecurityDeposit", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<SecurityDeposit>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0m); + securityDeposit.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var startDate = runtimeEntityType.AddProperty( + "StartDate", + typeof(DateTime), + propertyInfo: typeof(LeaseOffer).GetProperty("StartDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<StartDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(LeaseOffer).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var terms = runtimeEntityType.AddProperty( + "Terms", + typeof(string), + propertyInfo: typeof(LeaseOffer).GetProperty("Terms", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<Terms>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 2000); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { prospectiveTenantId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { rentalApplicationId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(LeaseOffer).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ProspectiveTenantId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var prospectiveTenant = declaringEntityType.AddNavigation("ProspectiveTenant", + runtimeForeignKey, + onDependent: true, + typeof(ProspectiveTenant), + propertyInfo: typeof(LeaseOffer).GetProperty("ProspectiveTenant", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<ProspectiveTenant>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("RentalApplicationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var rentalApplication = declaringEntityType.AddNavigation("RentalApplication", + runtimeForeignKey, + onDependent: true, + typeof(RentalApplication), + propertyInfo: typeof(LeaseOffer).GetProperty("RentalApplication", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(LeaseOffer).GetField("<RentalApplication>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "LeaseOffers"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/MaintenanceRequestEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/MaintenanceRequestEntityType.cs new file mode 100644 index 0000000..31f88f9 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/MaintenanceRequestEntityType.cs @@ -0,0 +1,298 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class MaintenanceRequestEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.MaintenanceRequest", + typeof(MaintenanceRequest), + baseEntityType, + propertyCount: 26, + navigationCount: 3, + foreignKeyCount: 2, + unnamedIndexCount: 5, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var actualCost = runtimeEntityType.AddProperty( + "ActualCost", + typeof(decimal), + propertyInfo: typeof(MaintenanceRequest).GetProperty("ActualCost", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<ActualCost>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + actualCost.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var assignedTo = runtimeEntityType.AddProperty( + "AssignedTo", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("AssignedTo", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<AssignedTo>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var calendarEventId = runtimeEntityType.AddProperty( + "CalendarEventId", + typeof(Guid?), + propertyInfo: typeof(MaintenanceRequest).GetProperty("CalendarEventId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<CalendarEventId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var completedOn = runtimeEntityType.AddProperty( + "CompletedOn", + typeof(DateTime?), + propertyInfo: typeof(MaintenanceRequest).GetProperty("CompletedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<CompletedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<Description>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 2000); + + var estimatedCost = runtimeEntityType.AddProperty( + "EstimatedCost", + typeof(decimal), + propertyInfo: typeof(MaintenanceRequest).GetProperty("EstimatedCost", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<EstimatedCost>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + estimatedCost.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid?), + propertyInfo: typeof(MaintenanceRequest).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var priority = runtimeEntityType.AddProperty( + "Priority", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("Priority", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<Priority>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(MaintenanceRequest).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var requestType = runtimeEntityType.AddProperty( + "RequestType", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("RequestType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<RequestType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var requestedBy = runtimeEntityType.AddProperty( + "RequestedBy", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("RequestedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<RequestedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var requestedByEmail = runtimeEntityType.AddProperty( + "RequestedByEmail", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("RequestedByEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<RequestedByEmail>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var requestedByPhone = runtimeEntityType.AddProperty( + "RequestedByPhone", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("RequestedByPhone", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<RequestedByPhone>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var requestedOn = runtimeEntityType.AddProperty( + "RequestedOn", + typeof(DateTime), + propertyInfo: typeof(MaintenanceRequest).GetProperty("RequestedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<RequestedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var resolutionNotes = runtimeEntityType.AddProperty( + "ResolutionNotes", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("ResolutionNotes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<ResolutionNotes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 2000); + + var scheduledOn = runtimeEntityType.AddProperty( + "ScheduledOn", + typeof(DateTime?), + propertyInfo: typeof(MaintenanceRequest).GetProperty("ScheduledOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<ScheduledOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var title = runtimeEntityType.AddProperty( + "Title", + typeof(string), + propertyInfo: typeof(MaintenanceRequest).GetProperty("Title", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<Title>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { leaseId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { priority }); + + var index1 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { requestedOn }); + + var index3 = runtimeEntityType.AddIndex( + new[] { status }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(MaintenanceRequest).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(MaintenanceRequest).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var maintenanceRequests = principalEntityType.AddNavigation("MaintenanceRequests", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<MaintenanceRequest>), + propertyInfo: typeof(Property).GetProperty("MaintenanceRequests", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<MaintenanceRequests>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "MaintenanceRequests"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/NoteEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/NoteEntityType.cs new file mode 100644 index 0000000..0946d28 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/NoteEntityType.cs @@ -0,0 +1,133 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class NoteEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Note", + typeof(Note), + baseEntityType, + propertyCount: 12, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var content = runtimeEntityType.AddProperty( + "Content", + typeof(string), + propertyInfo: typeof(Note).GetProperty("Content", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Note).GetField("<Content>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 5000); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var entityId = runtimeEntityType.AddProperty( + "EntityId", + typeof(Guid), + propertyInfo: typeof(Note).GetProperty("EntityId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Note).GetField("<EntityId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var entityType = runtimeEntityType.AddProperty( + "EntityType", + typeof(string), + propertyInfo: typeof(Note).GetProperty("EntityType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Note).GetField("<EntityType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var userFullName = runtimeEntityType.AddProperty( + "UserFullName", + typeof(string), + propertyInfo: typeof(Note).GetProperty("UserFullName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Note).GetField("<UserFullName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Notes"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/NotificationEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/NotificationEntityType.cs new file mode 100644 index 0000000..0b20e26 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/NotificationEntityType.cs @@ -0,0 +1,276 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class NotificationEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Notification", + typeof(Notification), + baseEntityType, + propertyCount: 27, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 5, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var category = runtimeEntityType.AddProperty( + "Category", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("Category", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<Category>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var emailError = runtimeEntityType.AddProperty( + "EmailError", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("EmailError", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<EmailError>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var emailSent = runtimeEntityType.AddProperty( + "EmailSent", + typeof(bool), + propertyInfo: typeof(Notification).GetProperty("EmailSent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<EmailSent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var emailSentOn = runtimeEntityType.AddProperty( + "EmailSentOn", + typeof(DateTime?), + propertyInfo: typeof(Notification).GetProperty("EmailSentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<EmailSentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isRead = runtimeEntityType.AddProperty( + "IsRead", + typeof(bool), + propertyInfo: typeof(Notification).GetProperty("IsRead", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<IsRead>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var message = runtimeEntityType.AddProperty( + "Message", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("Message", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<Message>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 2000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var readOn = runtimeEntityType.AddProperty( + "ReadOn", + typeof(DateTime?), + propertyInfo: typeof(Notification).GetProperty("ReadOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<ReadOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var recipientUserId = runtimeEntityType.AddProperty( + "RecipientUserId", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("RecipientUserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<RecipientUserId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var relatedEntityId = runtimeEntityType.AddProperty( + "RelatedEntityId", + typeof(Guid?), + propertyInfo: typeof(Notification).GetProperty("RelatedEntityId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<RelatedEntityId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var relatedEntityType = runtimeEntityType.AddProperty( + "RelatedEntityType", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("RelatedEntityType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<RelatedEntityType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 50); + + var sMSError = runtimeEntityType.AddProperty( + "SMSError", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("SMSError", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<SMSError>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var sMSSent = runtimeEntityType.AddProperty( + "SMSSent", + typeof(bool), + propertyInfo: typeof(Notification).GetProperty("SMSSent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<SMSSent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sMSSentOn = runtimeEntityType.AddProperty( + "SMSSentOn", + typeof(DateTime?), + propertyInfo: typeof(Notification).GetProperty("SMSSentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<SMSSentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var sendEmail = runtimeEntityType.AddProperty( + "SendEmail", + typeof(bool), + propertyInfo: typeof(Notification).GetProperty("SendEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<SendEmail>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sendInApp = runtimeEntityType.AddProperty( + "SendInApp", + typeof(bool), + propertyInfo: typeof(Notification).GetProperty("SendInApp", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<SendInApp>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sendSMS = runtimeEntityType.AddProperty( + "SendSMS", + typeof(bool), + propertyInfo: typeof(Notification).GetProperty("SendSMS", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<SendSMS>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sentOn = runtimeEntityType.AddProperty( + "SentOn", + typeof(DateTime), + propertyInfo: typeof(Notification).GetProperty("SentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<SentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var title = runtimeEntityType.AddProperty( + "Title", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("Title", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<Title>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var type = runtimeEntityType.AddProperty( + "Type", + typeof(string), + propertyInfo: typeof(Notification).GetProperty("Type", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<Type>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { category }); + + var index0 = runtimeEntityType.AddIndex( + new[] { isRead }); + + var index1 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { recipientUserId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { sentOn }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var organization = declaringEntityType.AddNavigation("Organization", + runtimeForeignKey, + onDependent: true, + typeof(Organization), + propertyInfo: typeof(Notification).GetProperty("Organization", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Notification).GetField("<Organization>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Notifications"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/NotificationPreferencesEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/NotificationPreferencesEntityType.cs new file mode 100644 index 0000000..9769617 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/NotificationPreferencesEntityType.cs @@ -0,0 +1,270 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class NotificationPreferencesEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.NotificationPreferences", + typeof(NotificationPreferences), + baseEntityType, + propertyCount: 27, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dailyDigestTime = runtimeEntityType.AddProperty( + "DailyDigestTime", + typeof(TimeSpan), + propertyInfo: typeof(NotificationPreferences).GetProperty("DailyDigestTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<DailyDigestTime>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new TimeSpan(0, 0, 0, 0, 0)); + + var emailAddress = runtimeEntityType.AddProperty( + "EmailAddress", + typeof(string), + propertyInfo: typeof(NotificationPreferences).GetProperty("EmailAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EmailAddress>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + + var emailApplicationStatusChange = runtimeEntityType.AddProperty( + "EmailApplicationStatusChange", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EmailApplicationStatusChange", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EmailApplicationStatusChange>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var emailInspectionScheduled = runtimeEntityType.AddProperty( + "EmailInspectionScheduled", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EmailInspectionScheduled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EmailInspectionScheduled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var emailLeaseExpiring = runtimeEntityType.AddProperty( + "EmailLeaseExpiring", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EmailLeaseExpiring", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EmailLeaseExpiring>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var emailMaintenanceUpdate = runtimeEntityType.AddProperty( + "EmailMaintenanceUpdate", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EmailMaintenanceUpdate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EmailMaintenanceUpdate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var emailPaymentDue = runtimeEntityType.AddProperty( + "EmailPaymentDue", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EmailPaymentDue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EmailPaymentDue>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var emailPaymentReceived = runtimeEntityType.AddProperty( + "EmailPaymentReceived", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EmailPaymentReceived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EmailPaymentReceived>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var enableDailyDigest = runtimeEntityType.AddProperty( + "EnableDailyDigest", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EnableDailyDigest", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EnableDailyDigest>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var enableEmailNotifications = runtimeEntityType.AddProperty( + "EnableEmailNotifications", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EnableEmailNotifications", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EnableEmailNotifications>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var enableInAppNotifications = runtimeEntityType.AddProperty( + "EnableInAppNotifications", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EnableInAppNotifications", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EnableInAppNotifications>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var enableSMSNotifications = runtimeEntityType.AddProperty( + "EnableSMSNotifications", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EnableSMSNotifications", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EnableSMSNotifications>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var enableWeeklyDigest = runtimeEntityType.AddProperty( + "EnableWeeklyDigest", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("EnableWeeklyDigest", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<EnableWeeklyDigest>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var phoneNumber = runtimeEntityType.AddProperty( + "PhoneNumber", + typeof(string), + propertyInfo: typeof(NotificationPreferences).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<PhoneNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 20); + + var sMSLeaseExpiringUrgent = runtimeEntityType.AddProperty( + "SMSLeaseExpiringUrgent", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("SMSLeaseExpiringUrgent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<SMSLeaseExpiringUrgent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sMSMaintenanceEmergency = runtimeEntityType.AddProperty( + "SMSMaintenanceEmergency", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("SMSMaintenanceEmergency", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<SMSMaintenanceEmergency>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var sMSPaymentDue = runtimeEntityType.AddProperty( + "SMSPaymentDue", + typeof(bool), + propertyInfo: typeof(NotificationPreferences).GetProperty("SMSPaymentDue", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<SMSPaymentDue>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(NotificationPreferences).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<UserId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var weeklyDigestDay = runtimeEntityType.AddProperty( + "WeeklyDigestDay", + typeof(DayOfWeek), + propertyInfo: typeof(NotificationPreferences).GetProperty("WeeklyDigestDay", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<WeeklyDigestDay>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + weeklyDigestDay.SetSentinelFromProviderValue(0); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { userId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { userId, organizationId }, + unique: true); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var organization = declaringEntityType.AddNavigation("Organization", + runtimeForeignKey, + onDependent: true, + typeof(Organization), + propertyInfo: typeof(NotificationPreferences).GetProperty("Organization", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(NotificationPreferences).GetField("<Organization>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "NotificationPreferences"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationEmailSettingsEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationEmailSettingsEntityType.cs new file mode 100644 index 0000000..3d759b6 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationEmailSettingsEntityType.cs @@ -0,0 +1,292 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class OrganizationEmailSettingsEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.OrganizationEmailSettings", + typeof(OrganizationEmailSettings), + baseEntityType, + propertyCount: 31, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dailyCountResetOn = runtimeEntityType.AddProperty( + "DailyCountResetOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("DailyCountResetOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<DailyCountResetOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var dailyLimit = runtimeEntityType.AddProperty( + "DailyLimit", + typeof(int?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("DailyLimit", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<DailyLimit>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var emailsSentThisMonth = runtimeEntityType.AddProperty( + "EmailsSentThisMonth", + typeof(int), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("EmailsSentThisMonth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<EmailsSentThisMonth>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var emailsSentToday = runtimeEntityType.AddProperty( + "EmailsSentToday", + typeof(int), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("EmailsSentToday", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<EmailsSentToday>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var enableSsl = runtimeEntityType.AddProperty( + "EnableSsl", + typeof(bool), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("EnableSsl", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<EnableSsl>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var fromEmail = runtimeEntityType.AddProperty( + "FromEmail", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("FromEmail", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<FromEmail>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + + var fromName = runtimeEntityType.AddProperty( + "FromName", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("FromName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<FromName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isEmailEnabled = runtimeEntityType.AddProperty( + "IsEmailEnabled", + typeof(bool), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("IsEmailEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<IsEmailEnabled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isVerified = runtimeEntityType.AddProperty( + "IsVerified", + typeof(bool), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("IsVerified", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<IsVerified>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastEmailSentOn = runtimeEntityType.AddProperty( + "LastEmailSentOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("LastEmailSentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<LastEmailSentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastError = runtimeEntityType.AddProperty( + "LastError", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("LastError", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<LastError>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var lastErrorOn = runtimeEntityType.AddProperty( + "LastErrorOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("LastErrorOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<LastErrorOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastVerifiedOn = runtimeEntityType.AddProperty( + "LastVerifiedOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("LastVerifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<LastVerifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var monthlyCountResetOn = runtimeEntityType.AddProperty( + "MonthlyCountResetOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("MonthlyCountResetOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<MonthlyCountResetOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var monthlyLimit = runtimeEntityType.AddProperty( + "MonthlyLimit", + typeof(int?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("MonthlyLimit", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<MonthlyLimit>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var password = runtimeEntityType.AddProperty( + "Password", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("Password", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<Password>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var planType = runtimeEntityType.AddProperty( + "PlanType", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("PlanType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<PlanType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var providerName = runtimeEntityType.AddProperty( + "ProviderName", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("ProviderName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<ProviderName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var sendGridApiKeyEncrypted = runtimeEntityType.AddProperty( + "SendGridApiKeyEncrypted", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("SendGridApiKeyEncrypted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<SendGridApiKeyEncrypted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var smtpPort = runtimeEntityType.AddProperty( + "SmtpPort", + typeof(int), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("SmtpPort", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<SmtpPort>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var smtpServer = runtimeEntityType.AddProperty( + "SmtpServer", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("SmtpServer", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<SmtpServer>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var statsLastUpdatedOn = runtimeEntityType.AddProperty( + "StatsLastUpdatedOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("StatsLastUpdatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<StatsLastUpdatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var username = runtimeEntityType.AddProperty( + "Username", + typeof(string), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("Username", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<Username>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { organizationId }, + unique: true); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var organization = declaringEntityType.AddNavigation("Organization", + runtimeForeignKey, + onDependent: true, + typeof(Organization), + propertyInfo: typeof(OrganizationEmailSettings).GetProperty("Organization", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationEmailSettings).GetField("<Organization>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "OrganizationEmailSettings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationEntityType.cs new file mode 100644 index 0000000..c92d718 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationEntityType.cs @@ -0,0 +1,130 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class OrganizationEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Organization", + typeof(Organization), + baseEntityType, + propertyCount: 11, + navigationCount: 4, + unnamedIndexCount: 2, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(Organization).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(Organization).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(Organization).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var displayName = runtimeEntityType.AddProperty( + "DisplayName", + typeof(string), + propertyInfo: typeof(Organization).GetProperty("DisplayName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<DisplayName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isActive = runtimeEntityType.AddProperty( + "IsActive", + typeof(bool), + propertyInfo: typeof(Organization).GetProperty("IsActive", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<IsActive>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(Organization).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(Organization).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(Organization).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(Organization).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var ownerId = runtimeEntityType.AddProperty( + "OwnerId", + typeof(string), + propertyInfo: typeof(Organization).GetProperty("OwnerId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<OwnerId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var state = runtimeEntityType.AddProperty( + "State", + typeof(string), + propertyInfo: typeof(Organization).GetProperty("State", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<State>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { isActive }); + + var index0 = runtimeEntityType.AddIndex( + new[] { ownerId }); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Organizations"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationSMSSettingsEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationSMSSettingsEntityType.cs new file mode 100644 index 0000000..1dd26f8 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationSMSSettingsEntityType.cs @@ -0,0 +1,259 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class OrganizationSMSSettingsEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.OrganizationSMSSettings", + typeof(OrganizationSMSSettings), + baseEntityType, + propertyCount: 25, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var accountBalance = runtimeEntityType.AddProperty( + "AccountBalance", + typeof(decimal?), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("AccountBalance", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<AccountBalance>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + precision: 18, + scale: 2); + + var accountType = runtimeEntityType.AddProperty( + "AccountType", + typeof(string), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("AccountType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<AccountType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var costPerSMS = runtimeEntityType.AddProperty( + "CostPerSMS", + typeof(decimal?), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("CostPerSMS", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<CostPerSMS>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + precision: 18, + scale: 4); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dailyCountResetOn = runtimeEntityType.AddProperty( + "DailyCountResetOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("DailyCountResetOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<DailyCountResetOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSMSEnabled = runtimeEntityType.AddProperty( + "IsSMSEnabled", + typeof(bool), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("IsSMSEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<IsSMSEnabled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isVerified = runtimeEntityType.AddProperty( + "IsVerified", + typeof(bool), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("IsVerified", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<IsVerified>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastError = runtimeEntityType.AddProperty( + "LastError", + typeof(string), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("LastError", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<LastError>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastSMSSentOn = runtimeEntityType.AddProperty( + "LastSMSSentOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("LastSMSSentOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<LastSMSSentOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastVerifiedOn = runtimeEntityType.AddProperty( + "LastVerifiedOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("LastVerifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<LastVerifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var monthlyCountResetOn = runtimeEntityType.AddProperty( + "MonthlyCountResetOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("MonthlyCountResetOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<MonthlyCountResetOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var providerName = runtimeEntityType.AddProperty( + "ProviderName", + typeof(string), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("ProviderName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<ProviderName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var sMSSentThisMonth = runtimeEntityType.AddProperty( + "SMSSentThisMonth", + typeof(int), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("SMSSentThisMonth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<SMSSentThisMonth>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var sMSSentToday = runtimeEntityType.AddProperty( + "SMSSentToday", + typeof(int), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("SMSSentToday", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<SMSSentToday>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var statsLastUpdatedOn = runtimeEntityType.AddProperty( + "StatsLastUpdatedOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("StatsLastUpdatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<StatsLastUpdatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var twilioAccountSidEncrypted = runtimeEntityType.AddProperty( + "TwilioAccountSidEncrypted", + typeof(string), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("TwilioAccountSidEncrypted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<TwilioAccountSidEncrypted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var twilioAuthTokenEncrypted = runtimeEntityType.AddProperty( + "TwilioAuthTokenEncrypted", + typeof(string), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("TwilioAuthTokenEncrypted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<TwilioAuthTokenEncrypted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var twilioPhoneNumber = runtimeEntityType.AddProperty( + "TwilioPhoneNumber", + typeof(string), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("TwilioPhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<TwilioPhoneNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 20); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { organizationId }, + unique: true); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var organization = declaringEntityType.AddNavigation("Organization", + runtimeForeignKey, + onDependent: true, + typeof(Organization), + propertyInfo: typeof(OrganizationSMSSettings).GetProperty("Organization", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSMSSettings).GetField("<Organization>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "OrganizationSMSSettings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationSettingsEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationSettingsEntityType.cs new file mode 100644 index 0000000..149f63e --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationSettingsEntityType.cs @@ -0,0 +1,263 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class OrganizationSettingsEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.OrganizationSettings", + typeof(OrganizationSettings), + baseEntityType, + propertyCount: 28, + unnamedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var allowTenantDividendChoice = runtimeEntityType.AddProperty( + "AllowTenantDividendChoice", + typeof(bool), + propertyInfo: typeof(OrganizationSettings).GetProperty("AllowTenantDividendChoice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<AllowTenantDividendChoice>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var applicationExpirationDays = runtimeEntityType.AddProperty( + "ApplicationExpirationDays", + typeof(int), + propertyInfo: typeof(OrganizationSettings).GetProperty("ApplicationExpirationDays", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<ApplicationExpirationDays>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var applicationFeeEnabled = runtimeEntityType.AddProperty( + "ApplicationFeeEnabled", + typeof(bool), + propertyInfo: typeof(OrganizationSettings).GetProperty("ApplicationFeeEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<ApplicationFeeEnabled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var autoCalculateSecurityDeposit = runtimeEntityType.AddProperty( + "AutoCalculateSecurityDeposit", + typeof(bool), + propertyInfo: typeof(OrganizationSettings).GetProperty("AutoCalculateSecurityDeposit", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<AutoCalculateSecurityDeposit>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var defaultApplicationFee = runtimeEntityType.AddProperty( + "DefaultApplicationFee", + typeof(decimal), + propertyInfo: typeof(OrganizationSettings).GetProperty("DefaultApplicationFee", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<DefaultApplicationFee>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + + var defaultDividendPaymentMethod = runtimeEntityType.AddProperty( + "DefaultDividendPaymentMethod", + typeof(string), + propertyInfo: typeof(OrganizationSettings).GetProperty("DefaultDividendPaymentMethod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<DefaultDividendPaymentMethod>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var dividendDistributionMonth = runtimeEntityType.AddProperty( + "DividendDistributionMonth", + typeof(int), + propertyInfo: typeof(OrganizationSettings).GetProperty("DividendDistributionMonth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<DividendDistributionMonth>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lateFeeAutoApply = runtimeEntityType.AddProperty( + "LateFeeAutoApply", + typeof(bool), + propertyInfo: typeof(OrganizationSettings).GetProperty("LateFeeAutoApply", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<LateFeeAutoApply>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lateFeeEnabled = runtimeEntityType.AddProperty( + "LateFeeEnabled", + typeof(bool), + propertyInfo: typeof(OrganizationSettings).GetProperty("LateFeeEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<LateFeeEnabled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lateFeeGracePeriodDays = runtimeEntityType.AddProperty( + "LateFeeGracePeriodDays", + typeof(int), + propertyInfo: typeof(OrganizationSettings).GetProperty("LateFeeGracePeriodDays", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<LateFeeGracePeriodDays>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var lateFeePercentage = runtimeEntityType.AddProperty( + "LateFeePercentage", + typeof(decimal), + propertyInfo: typeof(OrganizationSettings).GetProperty("LateFeePercentage", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<LateFeePercentage>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 5, + scale: 4, + sentinel: 0m); + + var maxLateFeeAmount = runtimeEntityType.AddProperty( + "MaxLateFeeAmount", + typeof(decimal), + propertyInfo: typeof(OrganizationSettings).GetProperty("MaxLateFeeAmount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<MaxLateFeeAmount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + + var name = runtimeEntityType.AddProperty( + "Name", + typeof(string), + propertyInfo: typeof(OrganizationSettings).GetProperty("Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + providerPropertyType: typeof(string)); + organizationId.SetSentinelFromProviderValue("00000000-0000-0000-0000-000000000000"); + + var organizationSharePercentage = runtimeEntityType.AddProperty( + "OrganizationSharePercentage", + typeof(decimal), + propertyInfo: typeof(OrganizationSettings).GetProperty("OrganizationSharePercentage", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<OrganizationSharePercentage>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 6, + sentinel: 0m); + organizationSharePercentage.AddAnnotation("Relational:ColumnType", "decimal(18,6)"); + + var paymentReminderDaysBefore = runtimeEntityType.AddProperty( + "PaymentReminderDaysBefore", + typeof(int), + propertyInfo: typeof(OrganizationSettings).GetProperty("PaymentReminderDaysBefore", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<PaymentReminderDaysBefore>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var paymentReminderEnabled = runtimeEntityType.AddProperty( + "PaymentReminderEnabled", + typeof(bool), + propertyInfo: typeof(OrganizationSettings).GetProperty("PaymentReminderEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<PaymentReminderEnabled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var refundProcessingDays = runtimeEntityType.AddProperty( + "RefundProcessingDays", + typeof(int), + propertyInfo: typeof(OrganizationSettings).GetProperty("RefundProcessingDays", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<RefundProcessingDays>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var securityDepositInvestmentEnabled = runtimeEntityType.AddProperty( + "SecurityDepositInvestmentEnabled", + typeof(bool), + propertyInfo: typeof(OrganizationSettings).GetProperty("SecurityDepositInvestmentEnabled", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<SecurityDepositInvestmentEnabled>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var securityDepositMultiplier = runtimeEntityType.AddProperty( + "SecurityDepositMultiplier", + typeof(decimal), + propertyInfo: typeof(OrganizationSettings).GetProperty("SecurityDepositMultiplier", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<SecurityDepositMultiplier>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + securityDepositMultiplier.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var tourNoShowGracePeriodHours = runtimeEntityType.AddProperty( + "TourNoShowGracePeriodHours", + typeof(int), + propertyInfo: typeof(OrganizationSettings).GetProperty("TourNoShowGracePeriodHours", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationSettings).GetField("<TourNoShowGracePeriodHours>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { organizationId }, + unique: true); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "OrganizationSettings"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationUserEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationUserEntityType.cs new file mode 100644 index 0000000..3615ba2 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/OrganizationUserEntityType.cs @@ -0,0 +1,178 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class OrganizationUserEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.OrganizationUser", + typeof(OrganizationUser), + baseEntityType, + propertyCount: 13, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(OrganizationUser).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(OrganizationUser).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(OrganizationUser).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var grantedBy = runtimeEntityType.AddProperty( + "GrantedBy", + typeof(string), + propertyInfo: typeof(OrganizationUser).GetProperty("GrantedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<GrantedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var grantedOn = runtimeEntityType.AddProperty( + "GrantedOn", + typeof(DateTime), + propertyInfo: typeof(OrganizationUser).GetProperty("GrantedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<GrantedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var isActive = runtimeEntityType.AddProperty( + "IsActive", + typeof(bool), + propertyInfo: typeof(OrganizationUser).GetProperty("IsActive", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<IsActive>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(OrganizationUser).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(OrganizationUser).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationUser).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(OrganizationUser).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var revokedOn = runtimeEntityType.AddProperty( + "RevokedOn", + typeof(DateTime?), + propertyInfo: typeof(OrganizationUser).GetProperty("RevokedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<RevokedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var role = runtimeEntityType.AddProperty( + "Role", + typeof(string), + propertyInfo: typeof(OrganizationUser).GetProperty("Role", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<Role>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(OrganizationUser).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<UserId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { isActive }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { role }); + + var index2 = runtimeEntityType.AddIndex( + new[] { userId, organizationId }, + unique: true); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + var organization = declaringEntityType.AddNavigation("Organization", + runtimeForeignKey, + onDependent: true, + typeof(Organization), + propertyInfo: typeof(OrganizationUser).GetProperty("Organization", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(OrganizationUser).GetField("<Organization>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var organizationUsers = principalEntityType.AddNavigation("OrganizationUsers", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<OrganizationUser>), + propertyInfo: typeof(Organization).GetProperty("OrganizationUsers", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<OrganizationUsers>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "OrganizationUsers"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/PaymentEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/PaymentEntityType.cs new file mode 100644 index 0000000..6c4af08 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/PaymentEntityType.cs @@ -0,0 +1,225 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class PaymentEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Payment", + typeof(Payment), + baseEntityType, + propertyCount: 15, + navigationCount: 2, + foreignKeyCount: 3, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var amount = runtimeEntityType.AddProperty( + "Amount", + typeof(decimal), + propertyInfo: typeof(Payment).GetProperty("Amount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<Amount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + amount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var documentId = runtimeEntityType.AddProperty( + "DocumentId", + typeof(Guid?), + propertyInfo: typeof(Payment).GetProperty("DocumentId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<DocumentId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var invoiceId = runtimeEntityType.AddProperty( + "InvoiceId", + typeof(Guid), + propertyInfo: typeof(Payment).GetProperty("InvoiceId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<InvoiceId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(Payment).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 1000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var paidOn = runtimeEntityType.AddProperty( + "PaidOn", + typeof(DateTime), + propertyInfo: typeof(Payment).GetProperty("PaidOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<PaidOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var paymentMethod = runtimeEntityType.AddProperty( + "PaymentMethod", + typeof(string), + propertyInfo: typeof(Payment).GetProperty("PaymentMethod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<PaymentMethod>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var paymentNumber = runtimeEntityType.AddProperty( + "PaymentNumber", + typeof(string), + propertyInfo: typeof(Payment).GetProperty("PaymentNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<PaymentNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { documentId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { invoiceId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { organizationId, paymentNumber }, + unique: true); + index1.AddAnnotation("Relational:Name", "IX_Payment_OrgId_PaymentNumber"); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("DocumentId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var document = declaringEntityType.AddNavigation("Document", + runtimeForeignKey, + onDependent: true, + typeof(Document), + propertyInfo: typeof(Payment).GetProperty("Document", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<Document>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("InvoiceId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var invoice = declaringEntityType.AddNavigation("Invoice", + runtimeForeignKey, + onDependent: true, + typeof(Invoice), + propertyInfo: typeof(Payment).GetProperty("Invoice", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Payment).GetField("<Invoice>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var payments = principalEntityType.AddNavigation("Payments", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Payment>), + propertyInfo: typeof(Invoice).GetProperty("Payments", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Invoice).GetField("<Payments>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Cascade, + required: true); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Payments"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/PropertyEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/PropertyEntityType.cs new file mode 100644 index 0000000..6a2f1ad --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/PropertyEntityType.cs @@ -0,0 +1,253 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class PropertyEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Property", + typeof(Property), + baseEntityType, + propertyCount: 24, + navigationCount: 4, + foreignKeyCount: 1, + unnamedIndexCount: 2, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var address = runtimeEntityType.AddProperty( + "Address", + typeof(string), + propertyInfo: typeof(Property).GetProperty("Address", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Address>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var bathrooms = runtimeEntityType.AddProperty( + "Bathrooms", + typeof(decimal), + propertyInfo: typeof(Property).GetProperty("Bathrooms", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Bathrooms>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 3, + sentinel: 0m); + bathrooms.AddAnnotation("Relational:ColumnType", "decimal(3,1)"); + + var bedrooms = runtimeEntityType.AddProperty( + "Bedrooms", + typeof(int), + propertyInfo: typeof(Property).GetProperty("Bedrooms", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Bedrooms>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 3, + sentinel: 0); + + var city = runtimeEntityType.AddProperty( + "City", + typeof(string), + propertyInfo: typeof(Property).GetProperty("City", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<City>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(Property).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Description>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 1000); + + var isAvailable = runtimeEntityType.AddProperty( + "IsAvailable", + typeof(bool), + propertyInfo: typeof(Property).GetProperty("IsAvailable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<IsAvailable>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastRoutineInspectionDate = runtimeEntityType.AddProperty( + "LastRoutineInspectionDate", + typeof(DateTime?), + propertyInfo: typeof(Property).GetProperty("LastRoutineInspectionDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<LastRoutineInspectionDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var monthlyRent = runtimeEntityType.AddProperty( + "MonthlyRent", + typeof(decimal), + propertyInfo: typeof(Property).GetProperty("MonthlyRent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<MonthlyRent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + monthlyRent.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var nextRoutineInspectionDueDate = runtimeEntityType.AddProperty( + "NextRoutineInspectionDueDate", + typeof(DateTime?), + propertyInfo: typeof(Property).GetProperty("NextRoutineInspectionDueDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<NextRoutineInspectionDueDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyType = runtimeEntityType.AddProperty( + "PropertyType", + typeof(string), + propertyInfo: typeof(Property).GetProperty("PropertyType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<PropertyType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var routineInspectionIntervalMonths = runtimeEntityType.AddProperty( + "RoutineInspectionIntervalMonths", + typeof(int), + propertyInfo: typeof(Property).GetProperty("RoutineInspectionIntervalMonths", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<RoutineInspectionIntervalMonths>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var squareFeet = runtimeEntityType.AddProperty( + "SquareFeet", + typeof(int), + propertyInfo: typeof(Property).GetProperty("SquareFeet", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<SquareFeet>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 7, + sentinel: 0); + + var state = runtimeEntityType.AddProperty( + "State", + typeof(string), + propertyInfo: typeof(Property).GetProperty("State", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<State>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(Property).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var unitNumber = runtimeEntityType.AddProperty( + "UnitNumber", + typeof(string), + propertyInfo: typeof(Property).GetProperty("UnitNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<UnitNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 50); + + var zipCode = runtimeEntityType.AddProperty( + "ZipCode", + typeof(string), + propertyInfo: typeof(Property).GetProperty("ZipCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<ZipCode>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 10); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { address }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.NoAction, + required: true); + + var properties = principalEntityType.AddNavigation("Properties", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Property>), + propertyInfo: typeof(Organization).GetProperty("Properties", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<Properties>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Properties"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/ProspectiveTenantEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/ProspectiveTenantEntityType.cs new file mode 100644 index 0000000..2f4f961 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/ProspectiveTenantEntityType.cs @@ -0,0 +1,232 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class ProspectiveTenantEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.ProspectiveTenant", + typeof(ProspectiveTenant), + baseEntityType, + propertyCount: 21, + navigationCount: 3, + foreignKeyCount: 1, + unnamedIndexCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dateOfBirth = runtimeEntityType.AddProperty( + "DateOfBirth", + typeof(DateTime?), + propertyInfo: typeof(ProspectiveTenant).GetProperty("DateOfBirth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<DateOfBirth>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var desiredMoveInDate = runtimeEntityType.AddProperty( + "DesiredMoveInDate", + typeof(DateTime?), + propertyInfo: typeof(ProspectiveTenant).GetProperty("DesiredMoveInDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<DesiredMoveInDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var email = runtimeEntityType.AddProperty( + "Email", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<Email>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var firstContactedOn = runtimeEntityType.AddProperty( + "FirstContactedOn", + typeof(DateTime?), + propertyInfo: typeof(ProspectiveTenant).GetProperty("FirstContactedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<FirstContactedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var firstName = runtimeEntityType.AddProperty( + "FirstName", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("FirstName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<FirstName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var identificationNumber = runtimeEntityType.AddProperty( + "IdentificationNumber", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("IdentificationNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<IdentificationNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var identificationState = runtimeEntityType.AddProperty( + "IdentificationState", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("IdentificationState", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<IdentificationState>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2); + + var interestedPropertyId = runtimeEntityType.AddProperty( + "InterestedPropertyId", + typeof(Guid?), + propertyInfo: typeof(ProspectiveTenant).GetProperty("InterestedPropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<InterestedPropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastName = runtimeEntityType.AddProperty( + "LastName", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("LastName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<LastName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var phone = runtimeEntityType.AddProperty( + "Phone", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("Phone", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<Phone>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var source = runtimeEntityType.AddProperty( + "Source", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("Source", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<Source>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(ProspectiveTenant).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { email }); + + var index0 = runtimeEntityType.AddIndex( + new[] { interestedPropertyId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { status }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("InterestedPropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var interestedProperty = declaringEntityType.AddNavigation("InterestedProperty", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(ProspectiveTenant).GetProperty("InterestedProperty", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<InterestedProperty>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "ProspectiveTenants"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/RentalApplicationEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/RentalApplicationEntityType.cs new file mode 100644 index 0000000..5034794 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/RentalApplicationEntityType.cs @@ -0,0 +1,385 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class RentalApplicationEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.RentalApplication", + typeof(RentalApplication), + baseEntityType, + propertyCount: 37, + navigationCount: 3, + foreignKeyCount: 2, + unnamedIndexCount: 5, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var applicationFee = runtimeEntityType.AddProperty( + "ApplicationFee", + typeof(decimal), + propertyInfo: typeof(RentalApplication).GetProperty("ApplicationFee", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<ApplicationFee>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + applicationFee.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var applicationFeePaid = runtimeEntityType.AddProperty( + "ApplicationFeePaid", + typeof(bool), + propertyInfo: typeof(RentalApplication).GetProperty("ApplicationFeePaid", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<ApplicationFeePaid>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var applicationFeePaidOn = runtimeEntityType.AddProperty( + "ApplicationFeePaidOn", + typeof(DateTime?), + propertyInfo: typeof(RentalApplication).GetProperty("ApplicationFeePaidOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<ApplicationFeePaidOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var applicationFeePaymentMethod = runtimeEntityType.AddProperty( + "ApplicationFeePaymentMethod", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("ApplicationFeePaymentMethod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<ApplicationFeePaymentMethod>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 50); + + var appliedOn = runtimeEntityType.AddProperty( + "AppliedOn", + typeof(DateTime), + propertyInfo: typeof(RentalApplication).GetProperty("AppliedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<AppliedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var currentAddress = runtimeEntityType.AddProperty( + "CurrentAddress", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("CurrentAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<CurrentAddress>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var currentCity = runtimeEntityType.AddProperty( + "CurrentCity", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("CurrentCity", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<CurrentCity>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var currentRent = runtimeEntityType.AddProperty( + "CurrentRent", + typeof(decimal), + propertyInfo: typeof(RentalApplication).GetProperty("CurrentRent", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<CurrentRent>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + currentRent.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var currentState = runtimeEntityType.AddProperty( + "CurrentState", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("CurrentState", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<CurrentState>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 2); + + var currentZipCode = runtimeEntityType.AddProperty( + "CurrentZipCode", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("CurrentZipCode", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<CurrentZipCode>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 10); + + var decidedOn = runtimeEntityType.AddProperty( + "DecidedOn", + typeof(DateTime?), + propertyInfo: typeof(RentalApplication).GetProperty("DecidedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<DecidedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var decisionBy = runtimeEntityType.AddProperty( + "DecisionBy", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("DecisionBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<DecisionBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var denialReason = runtimeEntityType.AddProperty( + "DenialReason", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("DenialReason", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<DenialReason>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var employerName = runtimeEntityType.AddProperty( + "EmployerName", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("EmployerName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<EmployerName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var employmentLengthMonths = runtimeEntityType.AddProperty( + "EmploymentLengthMonths", + typeof(int), + propertyInfo: typeof(RentalApplication).GetProperty("EmploymentLengthMonths", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<EmploymentLengthMonths>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var expiresOn = runtimeEntityType.AddProperty( + "ExpiresOn", + typeof(DateTime?), + propertyInfo: typeof(RentalApplication).GetProperty("ExpiresOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<ExpiresOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var jobTitle = runtimeEntityType.AddProperty( + "JobTitle", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("JobTitle", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<JobTitle>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var landlordName = runtimeEntityType.AddProperty( + "LandlordName", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("LandlordName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<LandlordName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var landlordPhone = runtimeEntityType.AddProperty( + "LandlordPhone", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("LandlordPhone", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<LandlordPhone>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var monthlyIncome = runtimeEntityType.AddProperty( + "MonthlyIncome", + typeof(decimal), + propertyInfo: typeof(RentalApplication).GetProperty("MonthlyIncome", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<MonthlyIncome>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + monthlyIncome.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(RentalApplication).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var prospectiveTenantId = runtimeEntityType.AddProperty( + "ProspectiveTenantId", + typeof(Guid), + propertyInfo: typeof(RentalApplication).GetProperty("ProspectiveTenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<ProspectiveTenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var reference1Name = runtimeEntityType.AddProperty( + "Reference1Name", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("Reference1Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Reference1Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var reference1Phone = runtimeEntityType.AddProperty( + "Reference1Phone", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("Reference1Phone", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Reference1Phone>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var reference1Relationship = runtimeEntityType.AddProperty( + "Reference1Relationship", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("Reference1Relationship", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Reference1Relationship>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var reference2Name = runtimeEntityType.AddProperty( + "Reference2Name", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("Reference2Name", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Reference2Name>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 200); + + var reference2Phone = runtimeEntityType.AddProperty( + "Reference2Phone", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("Reference2Phone", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Reference2Phone>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 20); + + var reference2Relationship = runtimeEntityType.AddProperty( + "Reference2Relationship", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("Reference2Relationship", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Reference2Relationship>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(RentalApplication).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { appliedOn }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { prospectiveTenantId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { status }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(RentalApplication).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ProspectiveTenantId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var prospectiveTenant = declaringEntityType.AddNavigation("ProspectiveTenant", + runtimeForeignKey, + onDependent: true, + typeof(ProspectiveTenant), + propertyInfo: typeof(RentalApplication).GetProperty("ProspectiveTenant", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(RentalApplication).GetField("<ProspectiveTenant>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var applications = principalEntityType.AddNavigation("Applications", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<RentalApplication>), + propertyInfo: typeof(ProspectiveTenant).GetProperty("Applications", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<Applications>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "RentalApplications"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/RepairEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/RepairEntityType.cs new file mode 100644 index 0000000..2403f07 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/RepairEntityType.cs @@ -0,0 +1,315 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class RepairEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Repair", + typeof(Repair), + baseEntityType, + propertyCount: 25, + navigationCount: 3, + foreignKeyCount: 3, + unnamedIndexCount: 6, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var completedOn = runtimeEntityType.AddProperty( + "CompletedOn", + typeof(DateTime?), + propertyInfo: typeof(Repair).GetProperty("CompletedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<CompletedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var contactId = runtimeEntityType.AddProperty( + "ContactId", + typeof(Guid?), + propertyInfo: typeof(Repair).GetProperty("ContactId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<ContactId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var contactPerson = runtimeEntityType.AddProperty( + "ContactPerson", + typeof(string), + propertyInfo: typeof(Repair).GetProperty("ContactPerson", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<ContactPerson>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var contractorId = runtimeEntityType.AddProperty( + "ContractorId", + typeof(Guid?), + propertyInfo: typeof(Repair).GetProperty("ContractorId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<ContractorId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var contractorName = runtimeEntityType.AddProperty( + "ContractorName", + typeof(string), + propertyInfo: typeof(Repair).GetProperty("ContractorName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<ContractorName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var contractorPhone = runtimeEntityType.AddProperty( + "ContractorPhone", + typeof(string), + propertyInfo: typeof(Repair).GetProperty("ContractorPhone", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<ContractorPhone>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var cost = runtimeEntityType.AddProperty( + "Cost", + typeof(decimal), + propertyInfo: typeof(Repair).GetProperty("Cost", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<Cost>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + cost.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(Repair).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<Description>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var durationMinutes = runtimeEntityType.AddProperty( + "DurationMinutes", + typeof(int), + propertyInfo: typeof(Repair).GetProperty("DurationMinutes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<DurationMinutes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid?), + propertyInfo: typeof(Repair).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var maintenanceRequestId = runtimeEntityType.AddProperty( + "MaintenanceRequestId", + typeof(Guid?), + propertyInfo: typeof(Repair).GetProperty("MaintenanceRequestId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<MaintenanceRequestId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(Repair).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 2000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var partsReplaced = runtimeEntityType.AddProperty( + "PartsReplaced", + typeof(string), + propertyInfo: typeof(Repair).GetProperty("PartsReplaced", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<PartsReplaced>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(Repair).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var repairType = runtimeEntityType.AddProperty( + "RepairType", + typeof(string), + propertyInfo: typeof(Repair).GetProperty("RepairType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<RepairType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var warrantyApplies = runtimeEntityType.AddProperty( + "WarrantyApplies", + typeof(bool), + propertyInfo: typeof(Repair).GetProperty("WarrantyApplies", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<WarrantyApplies>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var warrantyExpiresOn = runtimeEntityType.AddProperty( + "WarrantyExpiresOn", + typeof(DateTime?), + propertyInfo: typeof(Repair).GetProperty("WarrantyExpiresOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<WarrantyExpiresOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { completedOn }); + + var index0 = runtimeEntityType.AddIndex( + new[] { leaseId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { maintenanceRequestId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index4 = runtimeEntityType.AddIndex( + new[] { repairType }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(Repair).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("MaintenanceRequestId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.SetNull); + + var maintenanceRequest = declaringEntityType.AddNavigation("MaintenanceRequest", + runtimeForeignKey, + onDependent: true, + typeof(MaintenanceRequest), + propertyInfo: typeof(Repair).GetProperty("MaintenanceRequest", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<MaintenanceRequest>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var repairs = principalEntityType.AddNavigation("Repairs", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Repair>), + propertyInfo: typeof(MaintenanceRequest).GetProperty("Repairs", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(MaintenanceRequest).GetField("<Repairs>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(Repair).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Repair).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var repairs = principalEntityType.AddNavigation("Repairs", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Repair>), + propertyInfo: typeof(Property).GetProperty("Repairs", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Property).GetField("<Repairs>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Repairs"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/SchemaVersionEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/SchemaVersionEntityType.cs new file mode 100644 index 0000000..61416af --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/SchemaVersionEntityType.cs @@ -0,0 +1,76 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class SchemaVersionEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.SchemaVersion", + typeof(SchemaVersion), + baseEntityType, + propertyCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(SchemaVersion).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SchemaVersion).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + + var appliedOn = runtimeEntityType.AddProperty( + "AppliedOn", + typeof(DateTime), + propertyInfo: typeof(SchemaVersion).GetProperty("AppliedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SchemaVersion).GetField("<AppliedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var description = runtimeEntityType.AddProperty( + "Description", + typeof(string), + propertyInfo: typeof(SchemaVersion).GetProperty("Description", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SchemaVersion).GetField("<Description>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var version = runtimeEntityType.AddProperty( + "Version", + typeof(string), + propertyInfo: typeof(SchemaVersion).GetProperty("Version", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SchemaVersion).GetField("<Version>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "SchemaVersions"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositDividendEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositDividendEntityType.cs new file mode 100644 index 0000000..3cf5bcf --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositDividendEntityType.cs @@ -0,0 +1,337 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class SecurityDepositDividendEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.SecurityDepositDividend", + typeof(SecurityDepositDividend), + baseEntityType, + propertyCount: 24, + navigationCount: 4, + foreignKeyCount: 4, + unnamedIndexCount: 6, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var baseDividendAmount = runtimeEntityType.AddProperty( + "BaseDividendAmount", + typeof(decimal), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("BaseDividendAmount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<BaseDividendAmount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + baseDividendAmount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var choiceMadeOn = runtimeEntityType.AddProperty( + "ChoiceMadeOn", + typeof(DateTime?), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("ChoiceMadeOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<ChoiceMadeOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dividendAmount = runtimeEntityType.AddProperty( + "DividendAmount", + typeof(decimal), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("DividendAmount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<DividendAmount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + dividendAmount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var investmentPoolId = runtimeEntityType.AddProperty( + "InvestmentPoolId", + typeof(Guid), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("InvestmentPoolId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<InvestmentPoolId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var mailingAddress = runtimeEntityType.AddProperty( + "MailingAddress", + typeof(string), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("MailingAddress", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<MailingAddress>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var monthsInPool = runtimeEntityType.AddProperty( + "MonthsInPool", + typeof(int), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("MonthsInPool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<MonthsInPool>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var paymentMethod = runtimeEntityType.AddProperty( + "PaymentMethod", + typeof(string), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("PaymentMethod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<PaymentMethod>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var paymentProcessedOn = runtimeEntityType.AddProperty( + "PaymentProcessedOn", + typeof(DateTime?), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("PaymentProcessedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<PaymentProcessedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var paymentReference = runtimeEntityType.AddProperty( + "PaymentReference", + typeof(string), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("PaymentReference", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<PaymentReference>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var prorationFactor = runtimeEntityType.AddProperty( + "ProrationFactor", + typeof(decimal), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("ProrationFactor", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<ProrationFactor>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 6, + sentinel: 0m); + prorationFactor.AddAnnotation("Relational:ColumnType", "decimal(18,6)"); + + var securityDepositId = runtimeEntityType.AddProperty( + "SecurityDepositId", + typeof(Guid), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("SecurityDepositId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<SecurityDepositId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var tenantId = runtimeEntityType.AddProperty( + "TenantId", + typeof(Guid), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("TenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<TenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var year = runtimeEntityType.AddProperty( + "Year", + typeof(int), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("Year", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<Year>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { investmentPoolId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { leaseId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { securityDepositId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { status }); + + var index3 = runtimeEntityType.AddIndex( + new[] { tenantId }); + + var index4 = runtimeEntityType.AddIndex( + new[] { year }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("InvestmentPoolId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var investmentPool = declaringEntityType.AddNavigation("InvestmentPool", + runtimeForeignKey, + onDependent: true, + typeof(SecurityDepositInvestmentPool), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("InvestmentPool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<InvestmentPool>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var dividends = principalEntityType.AddNavigation("Dividends", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<SecurityDepositDividend>), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("Dividends", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<Dividends>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("SecurityDepositId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var securityDeposit = declaringEntityType.AddNavigation("SecurityDeposit", + runtimeForeignKey, + onDependent: true, + typeof(SecurityDeposit), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("SecurityDeposit", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<SecurityDeposit>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var dividends = principalEntityType.AddNavigation("Dividends", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<SecurityDepositDividend>), + propertyInfo: typeof(SecurityDeposit).GetProperty("Dividends", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<Dividends>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey4(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TenantId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var tenant = declaringEntityType.AddNavigation("Tenant", + runtimeForeignKey, + onDependent: true, + typeof(Tenant), + propertyInfo: typeof(SecurityDepositDividend).GetProperty("Tenant", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositDividend).GetField("<Tenant>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "SecurityDepositDividends"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositEntityType.cs new file mode 100644 index 0000000..aa23065 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositEntityType.cs @@ -0,0 +1,290 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class SecurityDepositEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.SecurityDeposit", + typeof(SecurityDeposit), + baseEntityType, + propertyCount: 25, + navigationCount: 3, + foreignKeyCount: 2, + unnamedIndexCount: 4, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var amount = runtimeEntityType.AddProperty( + "Amount", + typeof(decimal), + propertyInfo: typeof(SecurityDeposit).GetProperty("Amount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<Amount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + amount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dateReceived = runtimeEntityType.AddProperty( + "DateReceived", + typeof(DateTime), + propertyInfo: typeof(SecurityDeposit).GetProperty("DateReceived", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<DateReceived>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var deductionsAmount = runtimeEntityType.AddProperty( + "DeductionsAmount", + typeof(decimal?), + propertyInfo: typeof(SecurityDeposit).GetProperty("DeductionsAmount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<DeductionsAmount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + precision: 18, + scale: 2); + deductionsAmount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var deductionsReason = runtimeEntityType.AddProperty( + "DeductionsReason", + typeof(string), + propertyInfo: typeof(SecurityDeposit).GetProperty("DeductionsReason", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<DeductionsReason>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var inInvestmentPool = runtimeEntityType.AddProperty( + "InInvestmentPool", + typeof(bool), + propertyInfo: typeof(SecurityDeposit).GetProperty("InInvestmentPool", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<InInvestmentPool>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var leaseId = runtimeEntityType.AddProperty( + "LeaseId", + typeof(Guid), + propertyInfo: typeof(SecurityDeposit).GetProperty("LeaseId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<LeaseId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(SecurityDeposit).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 500); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var paymentMethod = runtimeEntityType.AddProperty( + "PaymentMethod", + typeof(string), + propertyInfo: typeof(SecurityDeposit).GetProperty("PaymentMethod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<PaymentMethod>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var poolEntryDate = runtimeEntityType.AddProperty( + "PoolEntryDate", + typeof(DateTime?), + propertyInfo: typeof(SecurityDeposit).GetProperty("PoolEntryDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<PoolEntryDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var poolExitDate = runtimeEntityType.AddProperty( + "PoolExitDate", + typeof(DateTime?), + propertyInfo: typeof(SecurityDeposit).GetProperty("PoolExitDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<PoolExitDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var refundAmount = runtimeEntityType.AddProperty( + "RefundAmount", + typeof(decimal?), + propertyInfo: typeof(SecurityDeposit).GetProperty("RefundAmount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<RefundAmount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + precision: 18, + scale: 2); + refundAmount.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var refundMethod = runtimeEntityType.AddProperty( + "RefundMethod", + typeof(string), + propertyInfo: typeof(SecurityDeposit).GetProperty("RefundMethod", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<RefundMethod>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 50); + + var refundProcessedDate = runtimeEntityType.AddProperty( + "RefundProcessedDate", + typeof(DateTime?), + propertyInfo: typeof(SecurityDeposit).GetProperty("RefundProcessedDate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<RefundProcessedDate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var refundReference = runtimeEntityType.AddProperty( + "RefundReference", + typeof(string), + propertyInfo: typeof(SecurityDeposit).GetProperty("RefundReference", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<RefundReference>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(SecurityDeposit).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var tenantId = runtimeEntityType.AddProperty( + "TenantId", + typeof(Guid), + propertyInfo: typeof(SecurityDeposit).GetProperty("TenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<TenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var transactionReference = runtimeEntityType.AddProperty( + "TransactionReference", + typeof(string), + propertyInfo: typeof(SecurityDeposit).GetProperty("TransactionReference", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<TransactionReference>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { inInvestmentPool }); + + var index0 = runtimeEntityType.AddIndex( + new[] { leaseId }, + unique: true); + + var index1 = runtimeEntityType.AddIndex( + new[] { status }); + + var index2 = runtimeEntityType.AddIndex( + new[] { tenantId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("LeaseId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var lease = declaringEntityType.AddNavigation("Lease", + runtimeForeignKey, + onDependent: true, + typeof(Lease), + propertyInfo: typeof(SecurityDeposit).GetProperty("Lease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<Lease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("TenantId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var tenant = declaringEntityType.AddNavigation("Tenant", + runtimeForeignKey, + onDependent: true, + typeof(Tenant), + propertyInfo: typeof(SecurityDeposit).GetProperty("Tenant", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDeposit).GetField("<Tenant>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "SecurityDeposits"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositInvestmentPoolEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositInvestmentPoolEntityType.cs new file mode 100644 index 0000000..5c1cbe2 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/SecurityDepositInvestmentPoolEntityType.cs @@ -0,0 +1,239 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class SecurityDepositInvestmentPoolEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.SecurityDepositInvestmentPool", + typeof(SecurityDepositInvestmentPool), + baseEntityType, + propertyCount: 22, + navigationCount: 1, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var activeLeaseCount = runtimeEntityType.AddProperty( + "ActiveLeaseCount", + typeof(int), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("ActiveLeaseCount", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<ActiveLeaseCount>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dividendPerLease = runtimeEntityType.AddProperty( + "DividendPerLease", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("DividendPerLease", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<DividendPerLease>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + dividendPerLease.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var dividendsCalculatedOn = runtimeEntityType.AddProperty( + "DividendsCalculatedOn", + typeof(DateTime?), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("DividendsCalculatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<DividendsCalculatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var dividendsDistributedOn = runtimeEntityType.AddProperty( + "DividendsDistributedOn", + typeof(DateTime?), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("DividendsDistributedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<DividendsDistributedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var endingBalance = runtimeEntityType.AddProperty( + "EndingBalance", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("EndingBalance", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<EndingBalance>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + endingBalance.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 1000); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var organizationShare = runtimeEntityType.AddProperty( + "OrganizationShare", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("OrganizationShare", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<OrganizationShare>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + organizationShare.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var organizationSharePercentage = runtimeEntityType.AddProperty( + "OrganizationSharePercentage", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("OrganizationSharePercentage", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<OrganizationSharePercentage>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 6, + sentinel: 0m); + organizationSharePercentage.AddAnnotation("Relational:ColumnType", "decimal(18,6)"); + + var returnRate = runtimeEntityType.AddProperty( + "ReturnRate", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("ReturnRate", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<ReturnRate>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 6, + sentinel: 0m); + returnRate.AddAnnotation("Relational:ColumnType", "decimal(18,6)"); + + var startingBalance = runtimeEntityType.AddProperty( + "StartingBalance", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("StartingBalance", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<StartingBalance>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + startingBalance.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var tenantShareTotal = runtimeEntityType.AddProperty( + "TenantShareTotal", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("TenantShareTotal", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<TenantShareTotal>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + tenantShareTotal.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var totalEarnings = runtimeEntityType.AddProperty( + "TotalEarnings", + typeof(decimal), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("TotalEarnings", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<TotalEarnings>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + precision: 18, + scale: 2, + sentinel: 0m); + totalEarnings.AddAnnotation("Relational:ColumnType", "decimal(18,2)"); + + var year = runtimeEntityType.AddProperty( + "Year", + typeof(int), + propertyInfo: typeof(SecurityDepositInvestmentPool).GetProperty("Year", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(SecurityDepositInvestmentPool).GetField("<Year>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { status }); + + var index1 = runtimeEntityType.AddIndex( + new[] { year }, + unique: true); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "SecurityDepositInvestmentPools"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/TenantEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/TenantEntityType.cs new file mode 100644 index 0000000..3b9d655 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/TenantEntityType.cs @@ -0,0 +1,216 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class TenantEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Tenant", + typeof(Tenant), + baseEntityType, + propertyCount: 19, + navigationCount: 1, + foreignKeyCount: 1, + unnamedIndexCount: 3, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var dateOfBirth = runtimeEntityType.AddProperty( + "DateOfBirth", + typeof(DateTime?), + propertyInfo: typeof(Tenant).GetProperty("DateOfBirth", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<DateOfBirth>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var email = runtimeEntityType.AddProperty( + "Email", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<Email>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 255); + + var emergencyContactName = runtimeEntityType.AddProperty( + "EmergencyContactName", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("EmergencyContactName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<EmergencyContactName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 200); + + var emergencyContactPhone = runtimeEntityType.AddProperty( + "EmergencyContactPhone", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("EmergencyContactPhone", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<EmergencyContactPhone>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 20); + + var firstName = runtimeEntityType.AddProperty( + "FirstName", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("FirstName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<FirstName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var identificationNumber = runtimeEntityType.AddProperty( + "IdentificationNumber", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("IdentificationNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<IdentificationNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var isActive = runtimeEntityType.AddProperty( + "IsActive", + typeof(bool), + propertyInfo: typeof(Tenant).GetProperty("IsActive", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<IsActive>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastName = runtimeEntityType.AddProperty( + "LastName", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("LastName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<LastName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var notes = runtimeEntityType.AddProperty( + "Notes", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("Notes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<Notes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 500); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var phoneNumber = runtimeEntityType.AddProperty( + "PhoneNumber", + typeof(string), + propertyInfo: typeof(Tenant).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<PhoneNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 20); + + var prospectiveTenantId = runtimeEntityType.AddProperty( + "ProspectiveTenantId", + typeof(Guid?), + propertyInfo: typeof(Tenant).GetProperty("ProspectiveTenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tenant).GetField("<ProspectiveTenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { email }, + unique: true); + + var index0 = runtimeEntityType.AddIndex( + new[] { identificationNumber }, + unique: true); + + var index1 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("OrganizationId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.NoAction, + required: true); + + var tenants = principalEntityType.AddNavigation("Tenants", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Tenant>), + propertyInfo: typeof(Organization).GetProperty("Tenants", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Organization).GetField("<Tenants>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Tenants"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/TourEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/TourEntityType.cs new file mode 100644 index 0000000..8c82e37 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/TourEntityType.cs @@ -0,0 +1,259 @@ +// <auto-generated /> +using System; +using System.Collections.Generic; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class TourEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.Tour", + typeof(Tour), + baseEntityType, + propertyCount: 18, + navigationCount: 3, + foreignKeyCount: 3, + unnamedIndexCount: 6, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var calendarEventId = runtimeEntityType.AddProperty( + "CalendarEventId", + typeof(Guid?), + propertyInfo: typeof(Tour).GetProperty("CalendarEventId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<CalendarEventId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var checklistId = runtimeEntityType.AddProperty( + "ChecklistId", + typeof(Guid?), + propertyInfo: typeof(Tour).GetProperty("ChecklistId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<ChecklistId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var conductedBy = runtimeEntityType.AddProperty( + "ConductedBy", + typeof(string), + propertyInfo: typeof(Tour).GetProperty("ConductedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<ConductedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var durationMinutes = runtimeEntityType.AddProperty( + "DurationMinutes", + typeof(int), + propertyInfo: typeof(Tour).GetProperty("DurationMinutes", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<DurationMinutes>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var feedback = runtimeEntityType.AddProperty( + "Feedback", + typeof(string), + propertyInfo: typeof(Tour).GetProperty("Feedback", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<Feedback>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 2000); + + var interestLevel = runtimeEntityType.AddProperty( + "InterestLevel", + typeof(string), + propertyInfo: typeof(Tour).GetProperty("InterestLevel", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<InterestLevel>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 50); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var propertyId = runtimeEntityType.AddProperty( + "PropertyId", + typeof(Guid), + propertyInfo: typeof(Tour).GetProperty("PropertyId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<PropertyId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var prospectiveTenantId = runtimeEntityType.AddProperty( + "ProspectiveTenantId", + typeof(Guid), + propertyInfo: typeof(Tour).GetProperty("ProspectiveTenantId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<ProspectiveTenantId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var scheduledOn = runtimeEntityType.AddProperty( + "ScheduledOn", + typeof(DateTime), + propertyInfo: typeof(Tour).GetProperty("ScheduledOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<ScheduledOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var status = runtimeEntityType.AddProperty( + "Status", + typeof(string), + propertyInfo: typeof(Tour).GetProperty("Status", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<Status>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 50); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { checklistId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { propertyId }); + + var index2 = runtimeEntityType.AddIndex( + new[] { prospectiveTenantId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { scheduledOn }); + + var index4 = runtimeEntityType.AddIndex( + new[] { status }); + + return runtimeEntityType; + } + + public static RuntimeForeignKey CreateForeignKey1(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ChecklistId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType); + + var checklist = declaringEntityType.AddNavigation("Checklist", + runtimeForeignKey, + onDependent: true, + typeof(Checklist), + propertyInfo: typeof(Tour).GetProperty("Checklist", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<Checklist>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey2(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("PropertyId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var property = declaringEntityType.AddNavigation("Property", + runtimeForeignKey, + onDependent: true, + typeof(Property), + propertyInfo: typeof(Tour).GetProperty("Property", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<Property>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static RuntimeForeignKey CreateForeignKey3(RuntimeEntityType declaringEntityType, RuntimeEntityType principalEntityType) + { + var runtimeForeignKey = declaringEntityType.AddForeignKey(new[] { declaringEntityType.FindProperty("ProspectiveTenantId") }, + principalEntityType.FindKey(new[] { principalEntityType.FindProperty("Id") }), + principalEntityType, + deleteBehavior: DeleteBehavior.Restrict, + required: true); + + var prospectiveTenant = declaringEntityType.AddNavigation("ProspectiveTenant", + runtimeForeignKey, + onDependent: true, + typeof(ProspectiveTenant), + propertyInfo: typeof(Tour).GetProperty("ProspectiveTenant", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(Tour).GetField("<ProspectiveTenant>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var tours = principalEntityType.AddNavigation("Tours", + runtimeForeignKey, + onDependent: false, + typeof(ICollection<Tour>), + propertyInfo: typeof(ProspectiveTenant).GetProperty("Tours", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(ProspectiveTenant).GetField("<Tours>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + return runtimeForeignKey; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "Tours"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/UserProfileEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/UserProfileEntityType.cs new file mode 100644 index 0000000..112ac6d --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/UserProfileEntityType.cs @@ -0,0 +1,159 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class UserProfileEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.UserProfile", + typeof(UserProfile), + baseEntityType, + propertyCount: 14, + unnamedIndexCount: 5, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var activeOrganizationId = runtimeEntityType.AddProperty( + "ActiveOrganizationId", + typeof(Guid?), + propertyInfo: typeof(UserProfile).GetProperty("ActiveOrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(UserProfile).GetField("<ActiveOrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var email = runtimeEntityType.AddProperty( + "Email", + typeof(string), + propertyInfo: typeof(UserProfile).GetProperty("Email", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(UserProfile).GetField("<Email>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var firstName = runtimeEntityType.AddProperty( + "FirstName", + typeof(string), + propertyInfo: typeof(UserProfile).GetProperty("FirstName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(UserProfile).GetField("<FirstName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var lastName = runtimeEntityType.AddProperty( + "LastName", + typeof(string), + propertyInfo: typeof(UserProfile).GetProperty("LastName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(UserProfile).GetField("<LastName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid?), + propertyInfo: typeof(UserProfile).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(UserProfile).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var phoneNumber = runtimeEntityType.AddProperty( + "PhoneNumber", + typeof(string), + propertyInfo: typeof(UserProfile).GetProperty("PhoneNumber", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(UserProfile).GetField("<PhoneNumber>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var userId = runtimeEntityType.AddProperty( + "UserId", + typeof(string), + propertyInfo: typeof(UserProfile).GetProperty("UserId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(UserProfile).GetField("<UserId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { activeOrganizationId }); + + var index0 = runtimeEntityType.AddIndex( + new[] { email }); + + var index1 = runtimeEntityType.AddIndex( + new[] { isDeleted }); + + var index2 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { userId }, + unique: true); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "UserProfiles"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/CompiledModels/WorkflowAuditLogEntityType.cs b/1-Aquiis.Infrastructure/Data/CompiledModels/WorkflowAuditLogEntityType.cs new file mode 100644 index 0000000..9b65974 --- /dev/null +++ b/1-Aquiis.Infrastructure/Data/CompiledModels/WorkflowAuditLogEntityType.cs @@ -0,0 +1,185 @@ +// <auto-generated /> +using System; +using System.Reflection; +using Aquiis.Core.Entities; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Aquiis.Infrastructure.Data.CompiledModels +{ + [EntityFrameworkInternal] + public partial class WorkflowAuditLogEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Aquiis.Core.Entities.WorkflowAuditLog", + typeof(WorkflowAuditLog), + baseEntityType, + propertyCount: 17, + unnamedIndexCount: 7, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<Id>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var action = runtimeEntityType.AddProperty( + "Action", + typeof(string), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("Action", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<Action>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var createdBy = runtimeEntityType.AddProperty( + "CreatedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("CreatedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + maxLength: 100); + + var createdOn = runtimeEntityType.AddProperty( + "CreatedOn", + typeof(DateTime), + propertyInfo: typeof(BaseModel).GetProperty("CreatedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<CreatedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var entityId = runtimeEntityType.AddProperty( + "EntityId", + typeof(Guid), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("EntityId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<EntityId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var entityType = runtimeEntityType.AddProperty( + "EntityType", + typeof(string), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("EntityType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<EntityType>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var fromStatus = runtimeEntityType.AddProperty( + "FromStatus", + typeof(string), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("FromStatus", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<FromStatus>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var isDeleted = runtimeEntityType.AddProperty( + "IsDeleted", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsDeleted", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsDeleted>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var isSampleData = runtimeEntityType.AddProperty( + "IsSampleData", + typeof(bool), + propertyInfo: typeof(BaseModel).GetProperty("IsSampleData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<IsSampleData>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: false); + + var lastModifiedBy = runtimeEntityType.AddProperty( + "LastModifiedBy", + typeof(string), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var lastModifiedOn = runtimeEntityType.AddProperty( + "LastModifiedOn", + typeof(DateTime?), + propertyInfo: typeof(BaseModel).GetProperty("LastModifiedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<LastModifiedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var metadata = runtimeEntityType.AddProperty( + "Metadata", + typeof(string), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("Metadata", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<Metadata>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var organizationId = runtimeEntityType.AddProperty( + "OrganizationId", + typeof(Guid), + propertyInfo: typeof(BaseModel).GetProperty("OrganizationId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(BaseModel).GetField("<OrganizationId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new Guid("00000000-0000-0000-0000-000000000000")); + + var performedBy = runtimeEntityType.AddProperty( + "PerformedBy", + typeof(string), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("PerformedBy", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<PerformedBy>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var performedOn = runtimeEntityType.AddProperty( + "PerformedOn", + typeof(DateTime), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("PerformedOn", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<PerformedOn>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + var reason = runtimeEntityType.AddProperty( + "Reason", + typeof(string), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("Reason", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<Reason>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true); + + var toStatus = runtimeEntityType.AddProperty( + "ToStatus", + typeof(string), + propertyInfo: typeof(WorkflowAuditLog).GetProperty("ToStatus", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WorkflowAuditLog).GetField("<ToStatus>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { action }); + + var index0 = runtimeEntityType.AddIndex( + new[] { entityId }); + + var index1 = runtimeEntityType.AddIndex( + new[] { entityType }); + + var index2 = runtimeEntityType.AddIndex( + new[] { organizationId }); + + var index3 = runtimeEntityType.AddIndex( + new[] { performedBy }); + + var index4 = runtimeEntityType.AddIndex( + new[] { performedOn }); + + var index5 = runtimeEntityType.AddIndex( + new[] { entityType, entityId }); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "WorkflowAuditLogs"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/1-Aquiis.Infrastructure/Data/SqlCipherConnectionInterceptor.cs b/1-Aquiis.Infrastructure/Data/SqlCipherConnectionInterceptor.cs index 445ad49..19cdd71 100644 --- a/1-Aquiis.Infrastructure/Data/SqlCipherConnectionInterceptor.cs +++ b/1-Aquiis.Infrastructure/Data/SqlCipherConnectionInterceptor.cs @@ -4,101 +4,107 @@ namespace Aquiis.Infrastructure.Data; /// <summary> -/// EF Core connection interceptor that sets SQLCipher encryption password after opening connections +/// EF Core connection interceptor that sets the SQLCipher encryption key on every connection open. +/// +/// Performance note: accepts either a plaintext passphrase or a pre-derived raw key in SQLCipher's +/// "x'hexbytes'" format. Raw keys skip the per-connection PBKDF2 derivation entirely, which +/// eliminates 20–50 ms of CPU work per connection. Use SqlCipherKeyDerivation.DeriveRawKey() +/// at startup to produce the raw key from the user's passphrase, then pass it here. /// </summary> public class SqlCipherConnectionInterceptor : DbConnectionInterceptor { - private readonly string? _encryptionPassword; - - // Toggle for verbose logging (useful for troubleshooting encryption issues) - private const bool EnableVerboseLogging = true; + private readonly string? _encryptionKey; - public SqlCipherConnectionInterceptor(string? encryptionPassword) + /// <param name="encryptionKey"> + /// Either a plaintext passphrase (SQLCipher runs PBKDF2 internally, slow) + /// or a pre-derived raw key in x'hexbytes' format (no PBKDF2, fast). + /// </param> + public SqlCipherConnectionInterceptor(string? encryptionKey) { - _encryptionPassword = encryptionPassword; - if (EnableVerboseLogging) - Console.WriteLine($"[SqlCipherConnectionInterceptor] Initialized with password: {(_encryptionPassword != null ? $"YES (length: {_encryptionPassword.Length})" : "NO")}"); + _encryptionKey = encryptionKey; } public override void ConnectionOpened(DbConnection connection, ConnectionEndEventData eventData) { - if (EnableVerboseLogging) - Console.WriteLine($"[SqlCipherConnectionInterceptor] ConnectionOpened called - Database: {connection.Database}"); - - if (!string.IsNullOrEmpty(_encryptionPassword)) + if (!string.IsNullOrEmpty(_encryptionKey)) { - using (var cmd = connection.CreateCommand()) + using var cmd = connection.CreateCommand(); + + if (_encryptionKey.StartsWith("x'", StringComparison.OrdinalIgnoreCase)) + { + // Pre-derived raw key — SQLCipher loads it directly, no PBKDF2 (~0 ms) + cmd.CommandText = $"PRAGMA key = \"{_encryptionKey}\";"; + cmd.ExecuteNonQuery(); + } + else { - // CRITICAL: Set key FIRST, before any other PRAGMA commands - if (EnableVerboseLogging) - Console.WriteLine("[SqlCipherConnectionInterceptor] Setting encryption key..."); - cmd.CommandText = $"PRAGMA key = '{_encryptionPassword}';"; + // Passphrase fallback — SQLCipher runs PBKDF2(256000) internally (~20–50 ms) + cmd.CommandText = $"PRAGMA key = '{_encryptionKey}';"; cmd.ExecuteNonQuery(); - - // Now set SQLCipher 4 parameters - if (EnableVerboseLogging) - Console.WriteLine("[SqlCipherConnectionInterceptor] Setting SQLCipher 4 parameters..."); + cmd.CommandText = "PRAGMA cipher_page_size = 4096;"; cmd.ExecuteNonQuery(); - cmd.CommandText = "PRAGMA kdf_iter = 256000;"; cmd.ExecuteNonQuery(); - cmd.CommandText = "PRAGMA cipher_hmac_algorithm = HMAC_SHA512;"; cmd.ExecuteNonQuery(); - cmd.CommandText = "PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA512;"; cmd.ExecuteNonQuery(); - - if (EnableVerboseLogging) - Console.WriteLine("[SqlCipherConnectionInterceptor] Encryption configured successfully"); } } - else if (EnableVerboseLogging) + + // WAL mode is persistent in the database file — no-op if already set, upgrades fresh DBs. + // NORMAL synchronous is safe with WAL and reduces flush overhead on every commit. + using (var cmd = connection.CreateCommand()) { - Console.WriteLine("[SqlCipherConnectionInterceptor] No password provided, skipping encryption"); + cmd.CommandText = "PRAGMA journal_mode = WAL;"; + cmd.ExecuteNonQuery(); + cmd.CommandText = "PRAGMA synchronous = NORMAL;"; + cmd.ExecuteNonQuery(); } + base.ConnectionOpened(connection, eventData); } public override async Task ConnectionOpenedAsync(DbConnection connection, ConnectionEndEventData eventData, CancellationToken cancellationToken = default) { - if (EnableVerboseLogging) - Console.WriteLine($"[SqlCipherConnectionInterceptor] ConnectionOpenedAsync called - Database: {connection.Database}"); - - if (!string.IsNullOrEmpty(_encryptionPassword)) + if (!string.IsNullOrEmpty(_encryptionKey)) { - using (var cmd = connection.CreateCommand()) + using var cmd = connection.CreateCommand(); + + if (_encryptionKey.StartsWith("x'", StringComparison.OrdinalIgnoreCase)) + { + // Pre-derived raw key — SQLCipher loads it directly, no PBKDF2 (~0 ms) + cmd.CommandText = $"PRAGMA key = \"{_encryptionKey}\";"; + await cmd.ExecuteNonQueryAsync(cancellationToken); + } + else { - // CRITICAL: Set key FIRST, before any other PRAGMA commands - if (EnableVerboseLogging) - Console.WriteLine("[SqlCipherConnectionInterceptor] Setting encryption key (async)..."); - cmd.CommandText = $"PRAGMA key = '{_encryptionPassword}';"; + // Passphrase fallback — SQLCipher runs PBKDF2(256000) internally (~20–50 ms) + cmd.CommandText = $"PRAGMA key = '{_encryptionKey}';"; await cmd.ExecuteNonQueryAsync(cancellationToken); - - // Now set SQLCipher 4 parameters - if (EnableVerboseLogging) - Console.WriteLine("[SqlCipherConnectionInterceptor] Setting SQLCipher 4 parameters (async)..."); + cmd.CommandText = "PRAGMA cipher_page_size = 4096;"; await cmd.ExecuteNonQueryAsync(cancellationToken); - cmd.CommandText = "PRAGMA kdf_iter = 256000;"; await cmd.ExecuteNonQueryAsync(cancellationToken); - cmd.CommandText = "PRAGMA cipher_hmac_algorithm = HMAC_SHA512;"; await cmd.ExecuteNonQueryAsync(cancellationToken); - cmd.CommandText = "PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA512;"; await cmd.ExecuteNonQueryAsync(cancellationToken); - - if (EnableVerboseLogging) - Console.WriteLine("[SqlCipherConnectionInterceptor] Encryption configured successfully (async)"); } } - else if (EnableVerboseLogging) + + // WAL mode is persistent in the database file — no-op if already set, upgrades fresh DBs. + // NORMAL synchronous is safe with WAL and reduces flush overhead on every commit. + using (var cmd = connection.CreateCommand()) { - Console.WriteLine("[SqlCipherConnectionInterceptor] No password provided, skipping encryption (async)"); + cmd.CommandText = "PRAGMA journal_mode = WAL;"; + await cmd.ExecuteNonQueryAsync(cancellationToken); + cmd.CommandText = "PRAGMA synchronous = NORMAL;"; + await cmd.ExecuteNonQueryAsync(cancellationToken); } + await base.ConnectionOpenedAsync(connection, eventData, cancellationToken); } } diff --git a/1-Aquiis.Infrastructure/Interfaces/IKeychainService.cs b/1-Aquiis.Infrastructure/Interfaces/IKeychainService.cs new file mode 100644 index 0000000..17b307b --- /dev/null +++ b/1-Aquiis.Infrastructure/Interfaces/IKeychainService.cs @@ -0,0 +1,20 @@ +namespace Aquiis.Infrastructure.Interfaces; + +/// <summary> +/// Abstraction for platform-specific secure key storage. +/// Linux: uses libsecret (secret-tool). Windows: uses DPAPI encrypted file. +/// </summary> +public interface IKeychainService +{ + /// <summary>Store a password/key in the platform keychain</summary> + bool StoreKey(string password, string label = "Aquiis Database Encryption Key"); + + /// <summary>Retrieve the stored password/key, or null if not found</summary> + string? RetrieveKey(); + + /// <summary>Remove the stored password/key</summary> + bool RemoveKey(); + + /// <summary>Check if the keychain service is available on this platform</summary> + bool IsAvailable(); +} diff --git a/1-Aquiis.Infrastructure/Services/DatabaseEncryptionService.cs b/1-Aquiis.Infrastructure/Services/DatabaseEncryptionService.cs index 32da922..40fab5d 100644 --- a/1-Aquiis.Infrastructure/Services/DatabaseEncryptionService.cs +++ b/1-Aquiis.Infrastructure/Services/DatabaseEncryptionService.cs @@ -1,3 +1,4 @@ +using Aquiis.Infrastructure.Interfaces; using Microsoft.Data.Sqlite; using Microsoft.Extensions.Logging; using System.Text; @@ -11,12 +12,12 @@ namespace Aquiis.Infrastructure.Services; public class DatabaseEncryptionService { private readonly PasswordDerivationService _passwordDerivation; - private readonly LinuxKeychainService _keychain; + private readonly IKeychainService _keychain; private readonly ILogger<DatabaseEncryptionService> _logger; public DatabaseEncryptionService( PasswordDerivationService passwordDerivation, - LinuxKeychainService keychain, + IKeychainService keychain, ILogger<DatabaseEncryptionService> logger) { _passwordDerivation = passwordDerivation; @@ -118,18 +119,19 @@ public DatabaseEncryptionService( return (false, null, "Failed to verify encrypted database"); } + // Clear pools so Windows releases the verified file handle before the caller moves the file + SqliteConnection.ClearAllPools(); + await Task.Delay(200); + // Store password in keychain (best effort - don't fail if keychain unavailable) - if (OperatingSystem.IsLinux()) + var stored = _keychain.StoreKey(password, "Aquiis Database Encryption Password"); + if (!stored) { - var stored = _keychain.StoreKey(password, "Aquiis Database Encryption Password"); - if (!stored) - { - _logger.LogWarning("Failed to store password in keychain - you'll need to enter it manually on next startup"); - } - else - { - _logger.LogInformation("Password stored in keychain successfully"); - } + _logger.LogWarning("Failed to store password in keychain - you'll need to enter it manually on next startup"); + } + else + { + _logger.LogInformation("Password stored in keychain successfully"); } _logger.LogInformation("Database encryption completed successfully"); @@ -184,13 +186,33 @@ public DatabaseEncryptionService( await encryptedConn.OpenAsync(); _logger.LogInformation("✅ Encrypted database opened successfully"); - // Set password using PRAGMA + // Set password using PRAGMA — must be first operation on the connection using (var cmd = encryptedConn.CreateCommand()) { cmd.CommandText = $"PRAGMA key = '{password}';"; await cmd.ExecuteNonQueryAsync(); _logger.LogInformation("Encryption key set with PRAGMA"); } + + // Explicitly set SQLCipher 4 parameters to match how the database was created. + // On Windows the native library does not always auto-detect these from the file + // header, causing decryption to silently fail with wrong defaults. + using (var cmd = encryptedConn.CreateCommand()) + { + cmd.CommandText = "PRAGMA cipher_page_size = 4096;"; + await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA kdf_iter = 256000;"; + await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA cipher_hmac_algorithm = HMAC_SHA512;"; + await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA512;"; + await cmd.ExecuteNonQueryAsync(); + + _logger.LogInformation("SQLCipher 4 cipher parameters set explicitly"); + } // Attach unencrypted database using (var cmd = encryptedConn.CreateCommand()) @@ -230,11 +252,12 @@ public DatabaseEncryptionService( return (false, null, "Failed to verify decrypted database"); } + // Clear pools so Windows releases the verified file handle before the caller moves the file + SqliteConnection.ClearAllPools(); + await Task.Delay(200); + // Remove password from keychain - if (OperatingSystem.IsLinux()) - { - _keychain.RemoveKey(); - } + _keychain.RemoveKey(); _logger.LogInformation("Database decryption completed successfully"); return (true, decryptedPath, null); @@ -258,11 +281,23 @@ private async Task<bool> VerifyEncryptedDatabaseAsync(string dbPath, string pass { await conn.OpenAsync(); - // Set the password using PRAGMA + // Set password then explicit SQLCipher 4 params — mirrors DecryptDatabaseAsync using (var cmd = conn.CreateCommand()) { cmd.CommandText = $"PRAGMA key = '{password}';"; await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA cipher_page_size = 4096;"; + await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA kdf_iter = 256000;"; + await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA cipher_hmac_algorithm = HMAC_SHA512;"; + await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA512;"; + await cmd.ExecuteNonQueryAsync(); } _logger.LogInformation("Encrypted database opened successfully"); @@ -310,22 +345,10 @@ private async Task<bool> VerifyPlaintextDatabaseAsync(string dbPath) /// <summary> /// Try to retrieve encryption key from keychain /// </summary> - public string? TryGetKeyFromKeychain() - { - if (!OperatingSystem.IsLinux()) - return null; - - return _keychain.RetrieveKey(); - } + public string? TryGetKeyFromKeychain() => _keychain.RetrieveKey(); /// <summary> /// Check if keychain service is available /// </summary> - public bool IsKeychainAvailable() - { - if (!OperatingSystem.IsLinux()) - return false; - - return _keychain.IsAvailable(); - } + public bool IsKeychainAvailable() => _keychain.IsAvailable(); } diff --git a/1-Aquiis.Infrastructure/Services/LinuxKeychainService.cs b/1-Aquiis.Infrastructure/Services/LinuxKeychainService.cs index 5e5a053..c213346 100644 --- a/1-Aquiis.Infrastructure/Services/LinuxKeychainService.cs +++ b/1-Aquiis.Infrastructure/Services/LinuxKeychainService.cs @@ -1,5 +1,6 @@ using System.Runtime.InteropServices; using System.Text; +using Aquiis.Infrastructure.Interfaces; namespace Aquiis.Infrastructure.Services; @@ -7,7 +8,7 @@ namespace Aquiis.Infrastructure.Services; /// Service for storing and retrieving encryption keys from Linux Secret Service (libsecret). /// Provides convenient auto-decryption on trusted devices. /// </summary> -public class LinuxKeychainService +public class LinuxKeychainService : IKeychainService { private const string Schema = "org.aquiis.database"; private const string KeyAttribute = "key-type"; diff --git a/1-Aquiis.Infrastructure/Services/WindowsKeychainService.cs b/1-Aquiis.Infrastructure/Services/WindowsKeychainService.cs new file mode 100644 index 0000000..95864f2 --- /dev/null +++ b/1-Aquiis.Infrastructure/Services/WindowsKeychainService.cs @@ -0,0 +1,117 @@ +using System.Runtime.Versioning; +using System.Security.Cryptography; +using System.Text; +using Aquiis.Infrastructure.Interfaces; + +namespace Aquiis.Infrastructure.Services; + +/// <summary> +/// Secure key storage for Windows using DPAPI (Data Protection API). +/// Encrypts the database password with the current user's Windows credentials +/// and stores it in a file under %APPDATA%\Aquiis\. Only the same user on the +/// same machine can decrypt the file — no user interaction needed on retrieval. +/// </summary> +[SupportedOSPlatform("windows")] +public class WindowsKeychainService : IKeychainService +{ + private readonly string _keyFilePath; + + /// <summary> + /// Initialize the Windows DPAPI keychain service. + /// </summary> + /// <param name="appName">App-specific identifier to prevent key conflicts (e.g. "SimpleStart-Electron")</param> + public WindowsKeychainService(string appName = "Aquiis-Electron") + { + var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + var aquiisDir = Path.Combine(appDataPath, "Aquiis"); + Directory.CreateDirectory(aquiisDir); + + // Sanitize appName for use as a filename component + var safeAppName = new string(appName.Where(c => char.IsLetterOrDigit(c) || c == '-' || c == '_').ToArray()); + _keyFilePath = Path.Combine(aquiisDir, $"aquiis_{safeAppName}.key"); + + Console.WriteLine($"[WindowsKeychainService] Initialized with key file: {_keyFilePath}"); + } + + /// <summary> + /// Store the encryption password using DPAPI. The data is encrypted with the + /// current user's credentials and written to a binary key file. + /// </summary> + public bool StoreKey(string password, string label = "Aquiis Database Encryption Key") + { + try + { + Console.WriteLine("[WindowsKeychainService] Storing password using DPAPI"); + var plainBytes = Encoding.UTF8.GetBytes(password); + var encryptedBytes = ProtectedData.Protect(plainBytes, null, DataProtectionScope.CurrentUser); + File.WriteAllBytes(_keyFilePath, encryptedBytes); + Console.WriteLine("[WindowsKeychainService] Password stored successfully using DPAPI"); + return true; + } + catch (Exception ex) + { + Console.WriteLine($"[WindowsKeychainService] Failed to store password: {ex.Message}"); + return false; + } + } + + /// <summary> + /// Retrieve the encryption password by decrypting the key file with DPAPI. + /// Returns null if the file does not exist or cannot be decrypted. + /// </summary> + public string? RetrieveKey() + { + if (!File.Exists(_keyFilePath)) + { + Console.WriteLine("[WindowsKeychainService] Key file not found"); + return null; + } + + try + { + Console.WriteLine("[WindowsKeychainService] Retrieving password using DPAPI"); + var encryptedBytes = File.ReadAllBytes(_keyFilePath); + var plainBytes = ProtectedData.Unprotect(encryptedBytes, null, DataProtectionScope.CurrentUser); + var password = Encoding.UTF8.GetString(plainBytes); + Console.WriteLine($"[WindowsKeychainService] Password retrieved successfully using DPAPI (length: {password.Length})"); + return password; + } + catch (CryptographicException ex) + { + Console.WriteLine($"[WindowsKeychainService] Failed to decrypt password (DPAPI): {ex.Message}"); + Console.WriteLine("[WindowsKeychainService] This usually means the key file was encrypted by a different user or machine"); + return null; + } + catch (Exception ex) + { + Console.WriteLine($"[WindowsKeychainService] Failed to retrieve password: {ex.Message}"); + return null; + } + } + + /// <summary> + /// Delete the key file, effectively removing the stored password. + /// </summary> + public bool RemoveKey() + { + try + { + if (File.Exists(_keyFilePath)) + { + File.Delete(_keyFilePath); + Console.WriteLine("[WindowsKeychainService] Key file deleted successfully"); + } + return true; + } + catch (Exception ex) + { + Console.WriteLine($"[WindowsKeychainService] Failed to remove key file: {ex.Message}"); + return false; + } + } + + /// <summary> + /// DPAPI is always available on Windows. + /// </summary> + public bool IsAvailable() => OperatingSystem.IsWindows(); +} diff --git a/2-Aquiis.Application/Services/DatabasePasswordService.cs b/2-Aquiis.Application/Services/DatabasePasswordService.cs index 1767dd9..f7a9360 100644 --- a/2-Aquiis.Application/Services/DatabasePasswordService.cs +++ b/2-Aquiis.Application/Services/DatabasePasswordService.cs @@ -1,5 +1,5 @@ using Aquiis.Core.Interfaces; -using Aquiis.Infrastructure.Services; +using Aquiis.Infrastructure.Interfaces; using Microsoft.Extensions.Logging; namespace Aquiis.Application.Services; @@ -10,11 +10,11 @@ namespace Aquiis.Application.Services; /// </summary> public class DatabasePasswordService { - private readonly LinuxKeychainService _keychain; + private readonly IKeychainService _keychain; private readonly ILogger<DatabasePasswordService> _logger; public DatabasePasswordService( - LinuxKeychainService keychain, + IKeychainService keychain, ILogger<DatabasePasswordService> logger) { _keychain = keychain; @@ -64,9 +64,6 @@ public async Task<bool> IsDatabaseEncryptedAsync(string dbPath) /// </summary> public string? TryGetPasswordFromKeychain() { - if (!OperatingSystem.IsLinux()) - return null; - var key = _keychain.RetrieveKey(); if (key != null) { diff --git a/2-Aquiis.Application/Services/DatabasePreviewService.cs b/2-Aquiis.Application/Services/DatabasePreviewService.cs index 0f4fc76..4600339 100644 --- a/2-Aquiis.Application/Services/DatabasePreviewService.cs +++ b/2-Aquiis.Application/Services/DatabasePreviewService.cs @@ -1,7 +1,7 @@ using Aquiis.Application.Models.DTOs; using Aquiis.Core.Entities; using Aquiis.Infrastructure.Data; -using Aquiis.Infrastructure.Services; +using Aquiis.Infrastructure.Interfaces; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; @@ -14,12 +14,12 @@ namespace Aquiis.Application.Services; /// </summary> public class DatabasePreviewService { - private readonly LinuxKeychainService _keychain; + private readonly IKeychainService _keychain; private readonly ILogger<DatabasePreviewService> _logger; private readonly string _backupDirectory; public DatabasePreviewService( - LinuxKeychainService keychain, + IKeychainService keychain, ILogger<DatabasePreviewService> logger) { _keychain = keychain; @@ -75,10 +75,7 @@ public async Task<bool> IsDatabaseEncryptedAsync(string backupFileName) /// </summary> public async Task<string?> TryGetKeychainPasswordAsync() { - if (!OperatingSystem.IsLinux()) - return null; - - await Task.CompletedTask; // Make method async + await Task.CompletedTask; // Keep method async var key = _keychain.RetrieveKey(); if (key != null) { diff --git a/2-Aquiis.Application/Services/DatabaseUnlockService.cs b/2-Aquiis.Application/Services/DatabaseUnlockService.cs index cd21173..973498d 100644 --- a/2-Aquiis.Application/Services/DatabaseUnlockService.cs +++ b/2-Aquiis.Application/Services/DatabaseUnlockService.cs @@ -1,6 +1,6 @@ +using Aquiis.Infrastructure.Interfaces; using Microsoft.Data.Sqlite; using Microsoft.Extensions.Logging; -using Aquiis.Infrastructure.Services; namespace Aquiis.Application.Services; @@ -10,11 +10,11 @@ namespace Aquiis.Application.Services; /// </summary> public class DatabaseUnlockService { - private readonly LinuxKeychainService _keychain; + private readonly IKeychainService _keychain; private readonly ILogger<DatabaseUnlockService> _logger; public DatabaseUnlockService( - LinuxKeychainService keychain, + IKeychainService keychain, ILogger<DatabaseUnlockService> logger) { _keychain = keychain; diff --git a/4-Aquiis.SimpleStart/Aquiis.SimpleStart.csproj b/4-Aquiis.SimpleStart/Aquiis.SimpleStart.csproj index fa508a7..8c0cbe1 100644 --- a/4-Aquiis.SimpleStart/Aquiis.SimpleStart.csproj +++ b/4-Aquiis.SimpleStart/Aquiis.SimpleStart.csproj @@ -5,7 +5,6 @@ <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <UserSecretsId>aspnet-Aquiis.SimpleStart-c69b6efe-bb20-41de-8cba-044207ebdce1</UserSecretsId> - <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> <MigrationsDirectory>Data/Migrations</MigrationsDirectory> <!-- Semantic Versioning --> @@ -60,4 +59,23 @@ <PackageReference Include="Twilio" Version="7.14.0" /> </ItemGroup> + <!-- + Force multi-file publish to eliminate the 30+ second startup extraction delay. + electronize start/build passes /p:PublishSingleFile=true on the command line, which + overrides project PropertyGroup values. A Target-level PropertyGroup assignment runs + AFTER command-line properties are evaluated but BEFORE the publish bundling targets, + so it reliably wins. With PublishSingleFile=false, native libraries (SQLCipher etc.) + are published as separate files alongside the exe — no extraction, near-instant load. + --> + <Target Name="DisableSingleFilePublish" BeforeTargets="PrepareForPublish"> + <PropertyGroup> + <PublishSingleFile>false</PublishSingleFile> + <IncludeNativeLibrariesForSelfExtract>false</IncludeNativeLibrariesForSelfExtract> + <!-- Pre-compile IL to native code at publish time to reduce JIT overhead on startup --> + <PublishReadyToRun>true</PublishReadyToRun> + <!-- Further optimize hot paths after ReadyToRun compilation --> + <TieredPGO>true</TieredPGO> + </PropertyGroup> + </Target> + </Project> diff --git a/4-Aquiis.SimpleStart/Assets/install-desktop-integration.sh b/4-Aquiis.SimpleStart/Assets/install-desktop-integration.sh index 1682457..c6b22a4 100755 --- a/4-Aquiis.SimpleStart/Assets/install-desktop-integration.sh +++ b/4-Aquiis.SimpleStart/Assets/install-desktop-integration.sh @@ -3,7 +3,9 @@ # Aquiis Desktop Integration Installer # Automatically creates desktop entry for Aquiis Property Management AppImage # -# Usage: ./install-desktop-integration.sh /path/to/AquiisPropertyManagement.AppImage +# Usage: +# First make this script executable: chmod +x install-desktop-integration.sh +# Then run: ./install-desktop-integration.sh /path/to/Aquiis-1.1.0-x86_64.AppImage # set -e @@ -37,6 +39,15 @@ APPIMAGE_NAME="$(basename "$APPIMAGE_PATH")" echo -e "${GREEN}Aquiis Desktop Integration Installer${NC}" echo "========================================" echo "" + +# Check if this script itself is executable (helpful reminder) +SCRIPT_PATH="$(readlink -f "$0")" +if [ ! -x "$SCRIPT_PATH" ]; then + echo -e "${YELLOW}Note: This script should be made executable for convenience:${NC}" + echo " chmod +x $(basename "$SCRIPT_PATH")" + echo "" +fi + echo "AppImage: $APPIMAGE_NAME" echo "Location: $APPIMAGE_DIR" echo "" @@ -55,6 +66,10 @@ else echo "✓ AppImage already in ~/Applications/" fi +# Make AppImage executable +chmod +x "$APPIMAGE_PATH" +echo "✓ Made AppImage executable" + echo "" # Create directories @@ -87,14 +102,14 @@ fi cat > ~/.local/share/applications/aquiis.desktop << EOF [Desktop Entry] Name=Aquiis Property Management -Comment=Multi-tenant property management system for small landlords +Comment=Multi-tenant property management system for DIY landlords and property managers Exec=${APPIMAGE_PATH} Icon=${ICON_PATH} Type=Application Categories=Office;Finance; Terminal=false StartupWMClass=Aquiis Property Management -X-AppImage-Version=1.0.0 +X-AppImage-Version=1.1.0 Keywords=property;management;landlord;rental;lease;tenant;invoice; EOF @@ -122,6 +137,10 @@ echo "" echo -e "${GREEN}Installation complete!${NC}" echo "" echo "AppImage location: $APPIMAGE_PATH" +echo "✓ AppImage is executable and ready to use" +echo "✓ Desktop integration installed" +echo "✓ Icons and application launcher updated" +echo "" echo "Aquiis Property Management should now appear in your application launcher." echo "You can search for 'Aquiis' or find it in Office/Finance categories." echo "" diff --git a/4-Aquiis.SimpleStart/Extensions/ElectronServiceExtensions.cs b/4-Aquiis.SimpleStart/Extensions/ElectronServiceExtensions.cs index ef43cd4..212bf6b 100644 --- a/4-Aquiis.SimpleStart/Extensions/ElectronServiceExtensions.cs +++ b/4-Aquiis.SimpleStart/Extensions/ElectronServiceExtensions.cs @@ -12,6 +12,7 @@ using Aquiis.SimpleStart.Entities; using Aquiis.SimpleStart.Services; // For ElectronPathService, WebPathService using Aquiis.Infrastructure.Services; // For DatabaseUnlockState +using Aquiis.Infrastructure.Interfaces; // For IKeychainService using Microsoft.Data.Sqlite; namespace Aquiis.SimpleStart.Extensions; @@ -22,7 +23,7 @@ namespace Aquiis.SimpleStart.Extensions; public static class ElectronServiceExtensions { // Toggle for verbose logging (useful for troubleshooting encryption setup) - private const bool EnableVerboseLogging = true; + private const bool EnableVerboseLogging = false; /// <summary> /// Adds all Electron-specific infrastructure services including database, identity, and path services. @@ -43,12 +44,11 @@ public static IServiceCollection AddElectronServices( // Check if database is encrypted and retrieve password if needed var encryptionPassword = GetEncryptionPasswordIfNeeded(connectionString); - if(EnableVerboseLogging) - { - Console.WriteLine("[ElectronServiceExtensions] Connection string obtained. Encryption needed: " + - (!string.IsNullOrEmpty(encryptionPassword)).ToString() + $", Password: {encryptionPassword}"); - } - + // Pre-derive raw AES key from passphrase (once at startup) so each connection open + // uses PRAGMA key = "x'hex'" and skips PBKDF2(256000), saving ~20–50 ms per connection. + if (!string.IsNullOrEmpty(encryptionPassword)) + encryptionPassword = PrepareEncryptionKey(encryptionPassword, connectionString); + // Register unlock state before any DbContext registration var unlockState = new DatabaseUnlockState { @@ -77,11 +77,9 @@ public static IServiceCollection AddElectronServices( if (!string.IsNullOrEmpty(encryptionPassword)) { interceptor = new SqlCipherConnectionInterceptor(encryptionPassword); - + // Clear connection pools to ensure no connections bypass the interceptor SqliteConnection.ClearAllPools(); - if (EnableVerboseLogging) - Console.WriteLine("[ElectronServiceExtensions] Encryption interceptor created and connection pools cleared"); } // ✅ Register Application layer (includes Infrastructure internally) with encryption interceptor @@ -101,8 +99,6 @@ public static IServiceCollection AddElectronServices( if (!string.IsNullOrEmpty(encryptionPassword)) { SqliteConnection.ClearAllPools(); - if (EnableVerboseLogging) - Console.WriteLine("[ElectronServiceExtensions] Connection pools cleared after DbContext registration"); } // Register DatabaseService now that both contexts are available @@ -189,9 +185,9 @@ public static IServiceCollection AddElectronServices( catch (SqliteException ex) when (ex.SqliteErrorCode == 26) // "file is not a database" { // Database is encrypted - try to get password from keychain - if (EnableVerboseLogging) - Console.WriteLine("Detected encrypted database, retrieving password from keychain..."); - var keychain = new LinuxKeychainService("SimpleStart-Electron"); // Pass app name to prevent keychain conflicts + var keychain = OperatingSystem.IsWindows() + ? (IKeychainService)new WindowsKeychainService("SimpleStart-Electron") + : new LinuxKeychainService("SimpleStart-Electron"); // Pass app name to prevent keychain conflicts Console.WriteLine("Attempting to retrieve encryption password from keychain..."); var password = keychain.RetrieveKey(); @@ -201,14 +197,9 @@ public static IServiceCollection AddElectronServices( Console.WriteLine("Database is encrypted but password not in keychain - will prompt user"); return null; // Signal that unlock is needed } - - if (EnableVerboseLogging) - Console.WriteLine($"Encryption password retrieved successfully (length: {password.Length} chars)"); // CRITICAL: Clear connection pool to prevent reuse of unencrypted connections SqliteConnection.ClearAllPools(); - if (EnableVerboseLogging) - Console.WriteLine("Connection pool cleared to force encryption on all new connections"); return password; } @@ -273,4 +264,47 @@ private static string ExtractDatabasePath(string connectionString) var builder = new SqliteConnectionStringBuilder(connectionString); return builder.DataSource; } + + /// <summary> + /// Pre-derives the AES-256 key from <paramref name="password"/> using SQLCipher 4's PBKDF2 + /// parameters (HMAC-SHA512, 256 000 iterations, 32-byte output). The salt is read from the + /// first 16 bytes of the database file — the same salt SQLCipher embedded when the database + /// was originally encrypted. The returned value is in SQLCipher's raw-key format + /// <c>x'hexbytes'</c>, which the interceptor passes directly as <c>PRAGMA key</c>, + /// skipping all PBKDF2 work on every subsequent connection open. + /// + /// Falls back to the original passphrase string if the file cannot be read or is too small + /// (e.g. first-run before the database exists), in which case the interceptor's passphrase + /// path handles key derivation as usual. + /// </summary> + private static string PrepareEncryptionKey(string password, string connectionString) + { + try + { + var dbPath = ExtractDatabasePath(connectionString); + + if (!File.Exists(dbPath) || new FileInfo(dbPath).Length < 16) + return password; // DB not yet created — passphrase path is fine + + // SQLCipher stores its PBKDF2 salt in the first 16 bytes of the database file + var salt = new byte[16]; + using (var fs = new FileStream(dbPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + if (fs.Read(salt, 0, 16) < 16) return password; + } + + // Derive using the same parameters SQLCipher 4 uses by default + var keyBytes = System.Security.Cryptography.Rfc2898DeriveBytes.Pbkdf2( + System.Text.Encoding.UTF8.GetBytes(password), + salt, + 256000, + System.Security.Cryptography.HashAlgorithmName.SHA512, + 32); // 256-bit AES key + return "x'" + Convert.ToHexString(keyBytes) + "'"; + } + catch + { + return password; // Any I/O or crypto error — fall back to passphrase + } + } } diff --git a/4-Aquiis.SimpleStart/Extensions/WebServiceExtensions.cs b/4-Aquiis.SimpleStart/Extensions/WebServiceExtensions.cs index f231ca7..94a723c 100644 --- a/4-Aquiis.SimpleStart/Extensions/WebServiceExtensions.cs +++ b/4-Aquiis.SimpleStart/Extensions/WebServiceExtensions.cs @@ -12,6 +12,7 @@ using Aquiis.SimpleStart.Entities; using Aquiis.SimpleStart.Services; // For ElectronPathService, WebPathService using Aquiis.Infrastructure.Services; // For DatabaseUnlockState +using Aquiis.Infrastructure.Interfaces; // For IKeychainService using Microsoft.Data.Sqlite; namespace Aquiis.SimpleStart.Extensions; @@ -22,7 +23,7 @@ namespace Aquiis.SimpleStart.Extensions; public static class WebServiceExtensions { // Toggle for verbose logging (useful for troubleshooting encryption setup) - private const bool EnableVerboseLogging = true; + private const bool EnableVerboseLogging = false; /// <summary> /// Adds all Web-specific infrastructure services including database and identity. @@ -48,6 +49,11 @@ public static IServiceCollection AddWebServices( // Check if database is encrypted and retrieve password if needed var encryptionPassword = GetEncryptionPasswordIfNeeded(connectionString); + // Pre-derive raw AES key from passphrase (once at startup) so each connection open + // uses PRAGMA key = "x'hex'" and skips PBKDF2(256000), saving ~20–50 ms per connection. + if (!string.IsNullOrEmpty(encryptionPassword)) + encryptionPassword = PrepareEncryptionKey(encryptionPassword, connectionString); + // Register unlock state before any DbContext registration var unlockState = new DatabaseUnlockState { @@ -76,11 +82,9 @@ public static IServiceCollection AddWebServices( if (!string.IsNullOrEmpty(encryptionPassword)) { interceptor = new SqlCipherConnectionInterceptor(encryptionPassword); - + // Clear connection pools to ensure no connections bypass the interceptor SqliteConnection.ClearAllPools(); - if (EnableVerboseLogging) - Console.WriteLine("Encryption interceptor created and connection pools cleared"); } // ✅ Register Application layer (includes Infrastructure internally) with encryption interceptor @@ -100,8 +104,6 @@ public static IServiceCollection AddWebServices( if (!string.IsNullOrEmpty(encryptionPassword)) { SqliteConnection.ClearAllPools(); - if (EnableVerboseLogging) - Console.WriteLine("Connection pools cleared after DbContext registration"); } // Register DatabaseService now that both contexts are available @@ -176,9 +178,9 @@ public static IServiceCollection AddWebServices( catch (SqliteException ex) when (ex.SqliteErrorCode == 26) // "file is not a database" { // Database is encrypted - try to get password from keychain - if (EnableVerboseLogging) - Console.WriteLine("Detected encrypted database, retrieving password from keychain..."); - var keychain = new LinuxKeychainService("SimpleStart-Web"); // Pass app name to prevent keychain conflicts + var keychain = OperatingSystem.IsWindows() + ? (IKeychainService)new WindowsKeychainService("SimpleStart-Web") + : new LinuxKeychainService("SimpleStart-Web"); // Pass app name to prevent keychain conflicts var password = keychain.RetrieveKey(); if (string.IsNullOrEmpty(password)) @@ -186,14 +188,9 @@ public static IServiceCollection AddWebServices( Console.WriteLine("Database is encrypted but password not in keychain - will prompt user"); return null; // Signal that unlock is needed } - - if (EnableVerboseLogging) - Console.WriteLine($"Encryption password retrieved successfully (length: {password.Length} chars)"); // CRITICAL: Clear connection pool to prevent reuse of unencrypted connections SqliteConnection.ClearAllPools(); - if (EnableVerboseLogging) - Console.WriteLine("Connection pool cleared to force encryption on all new connections"); return password; } @@ -247,6 +244,49 @@ private static string ExtractDatabasePath(string connectionString) var builder = new SqliteConnectionStringBuilder(connectionString); return builder.DataSource; } + + /// <summary> + /// Pre-derives the AES-256 key from <paramref name="password"/> using SQLCipher 4's PBKDF2 + /// parameters (HMAC-SHA512, 256 000 iterations, 32-byte output). The salt is read from the + /// first 16 bytes of the database file — the same salt SQLCipher embedded when the database + /// was originally encrypted. The returned value is in SQLCipher's raw-key format + /// <c>x'hexbytes'</c>, which the interceptor passes directly as <c>PRAGMA key</c>, + /// skipping all PBKDF2 work on every subsequent connection open. + /// + /// Falls back to the original passphrase string if the file cannot be read or is too small + /// (e.g. first-run before the database exists), in which case the interceptor's passphrase + /// path handles key derivation as usual. + /// </summary> + private static string PrepareEncryptionKey(string password, string connectionString) + { + try + { + var dbPath = ExtractDatabasePath(connectionString); + + if (!File.Exists(dbPath) || new FileInfo(dbPath).Length < 16) + return password; // DB not yet created — passphrase path is fine + + // SQLCipher stores its PBKDF2 salt in the first 16 bytes of the database file + var salt = new byte[16]; + using (var fs = new FileStream(dbPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + if (fs.Read(salt, 0, 16) < 16) return password; + } + + // Derive using the same parameters SQLCipher 4 uses by default + var keyBytes = System.Security.Cryptography.Rfc2898DeriveBytes.Pbkdf2( + System.Text.Encoding.UTF8.GetBytes(password), + salt, + 256000, + System.Security.Cryptography.HashAlgorithmName.SHA512, + 32); // 256-bit AES key + return "x'" + Convert.ToHexString(keyBytes) + "'"; + } + catch + { + return password; // Any I/O or crypto error — fall back to passphrase + } + } } /// <summary> diff --git a/4-Aquiis.SimpleStart/Features/Administration/Settings/Pages/DatabaseSettings.razor b/4-Aquiis.SimpleStart/Features/Administration/Settings/Pages/DatabaseSettings.razor index a0e1b7f..5def0b9 100644 --- a/4-Aquiis.SimpleStart/Features/Administration/Settings/Pages/DatabaseSettings.razor +++ b/4-Aquiis.SimpleStart/Features/Administration/Settings/Pages/DatabaseSettings.razor @@ -953,39 +953,26 @@ successMessage = "Encrypting database... This may take a moment."; StateHasChanged(); - // Step 2: Get database path and close connections + // Step 2: Get database path var dbPath = await PathService.GetDatabasePathAsync(); - await BackupService.PrepareForFileCopyAsync(); - // Step 3: Copy database file - var copyPath = $"{dbPath}.copy_to_encrypt"; - File.Copy(dbPath, copyPath, overwrite: true); - - // Step 4: Encrypt the copy (with raw password) + // Step 3: Encrypt the backup directly — avoids File.Copy of the live database var (success, encryptedPath, errorMsg) = - await EncryptionService.EncryptDatabaseAsync(copyPath, password); + await EncryptionService.EncryptDatabaseAsync(backupPath, password); if (!success || encryptedPath == null) { errorMessage = $"Encryption failed: {errorMsg}"; isEncryptionEnabled = false; - if (File.Exists(copyPath)) File.Delete(copyPath); - if (File.Exists($"{copyPath}-wal")) File.Delete($"{copyPath}-wal"); - if (File.Exists($"{copyPath}-shm")) File.Delete($"{copyPath}-shm"); if (encryptedPath != null && File.Exists(encryptedPath)) File.Delete(encryptedPath); StateHasChanged(); return; } - // Step 5: Stage encrypted db for restart + // Step 4: Stage encrypted db for restart var stagedRestorePath = $"{dbPath}.restore_pending"; File.Move(encryptedPath, stagedRestorePath, overwrite: true); - // Cleanup temp copy and SQLite auxiliary files - if (File.Exists(copyPath)) File.Delete(copyPath); - if (File.Exists($"{copyPath}-wal")) File.Delete($"{copyPath}-wal"); - if (File.Exists($"{copyPath}-shm")) File.Delete($"{copyPath}-shm"); - successMessage = "✅ Database encrypted successfully! Application will restart..."; StateHasChanged(); await Task.Delay(2000); @@ -1028,38 +1015,23 @@ return; } - successMessage = "Decrypting database copy... This may take a moment."; + successMessage = "Decrypting database... This may take a moment."; StateHasChanged(); // Get database path var dbPath = await PathService.GetDatabasePathAsync(); - // CRITICAL: Close connections and prepare for file copy - await BackupService.PrepareForFileCopyAsync(); - - successMessage = "Copying encrypted database... This may take a moment."; - StateHasChanged(); - - // Create a temporary copy to decrypt (can't decrypt live database - it's locked) - var tempCopyPath = $"{dbPath}.temp_for_decryption"; - File.Copy(dbPath, tempCopyPath, overwrite: true); - try { - // Decrypt the copy (not the live database) using raw password + // Decrypt the backup directly — avoids File.Copy of the live database var (success, decryptedPath, errorMsg) = - await EncryptionService.DecryptDatabaseAsync(tempCopyPath, password); + await EncryptionService.DecryptDatabaseAsync(backupPath, password); if (!success || decryptedPath == null) { errorMessage = $"Decryption failed: {errorMsg ?? "Invalid password or corrupted database"}"; isEncryptionEnabled = true; StateHasChanged(); - - // Cleanup temp files and SQLite auxiliary files - if (File.Exists(tempCopyPath)) File.Delete(tempCopyPath); - if (File.Exists($"{tempCopyPath}-wal")) File.Delete($"{tempCopyPath}-wal"); - if (File.Exists($"{tempCopyPath}-shm")) File.Delete($"{tempCopyPath}-shm"); if (decryptedPath != null && File.Exists(decryptedPath)) File.Delete(decryptedPath); return; } @@ -1068,11 +1040,6 @@ var stagedRestorePath = $"{dbPath}.restore_pending"; File.Move(decryptedPath, stagedRestorePath, overwrite: true); - // Cleanup temp copy and SQLite auxiliary files - if (File.Exists(tempCopyPath)) File.Delete(tempCopyPath); - if (File.Exists($"{tempCopyPath}-wal")) File.Delete($"{tempCopyPath}-wal"); - if (File.Exists($"{tempCopyPath}-shm")) File.Delete($"{tempCopyPath}-shm"); - successMessage = "✅ Database decrypted successfully! Application will restart..."; StateHasChanged(); await Task.Delay(2000); @@ -1093,9 +1060,6 @@ errorMessage = $"Decryption error: {ex.Message}"; isEncryptionEnabled = true; StateHasChanged(); - - // Cleanup on error - if (File.Exists(tempCopyPath)) File.Delete(tempCopyPath); } } catch (Exception ex) diff --git a/4-Aquiis.SimpleStart/Program.cs b/4-Aquiis.SimpleStart/Program.cs index 9dc1eb8..a95f4f4 100644 --- a/4-Aquiis.SimpleStart/Program.cs +++ b/4-Aquiis.SimpleStart/Program.cs @@ -8,6 +8,7 @@ using Aquiis.Core.Interfaces.Services; using Aquiis.SimpleStart.Extensions; using Aquiis.Infrastructure.Services; +using Aquiis.Infrastructure.Interfaces; using Aquiis.SimpleStart.Shared.Services; using Aquiis.SimpleStart.Shared.Authorization; using Aquiis.Application.Services; @@ -25,13 +26,14 @@ var builder = WebApplication.CreateBuilder(args); -// CRITICAL: Handle .restore_pending BEFORE any DbContext registration -// This ensures encrypted database detection happens on the correct file -HandlePendingRestore(builder.Configuration); - -// Configure for Electron +// Configure for Electron FIRST — this sets HybridSupport.IsElectronActive, which +// HandlePendingRestore depends on to compute the correct Electron user-data DB path. builder.WebHost.UseElectron(args); +// CRITICAL: Handle .restore_pending BEFORE any DbContext registration. +// Must run AFTER UseElectron so HybridSupport.IsElectronActive is true. +HandlePendingRestore(builder.Configuration); + // Configure URLs - use specific port for Electron if (HybridSupport.IsElectronActive) { @@ -183,10 +185,12 @@ // Database encryption services builder.Services.AddScoped<PasswordDerivationService>(); -builder.Services.AddScoped<LinuxKeychainService>(sp => +builder.Services.AddScoped<IKeychainService>(sp => { // Pass app name to prevent keychain conflicts between different apps and modes var appName = HybridSupport.IsElectronActive ? "SimpleStart-Electron" : "SimpleStart-Web"; + if (OperatingSystem.IsWindows()) + return new WindowsKeychainService(appName); return new LinuxKeychainService(appName); }); builder.Services.AddScoped<DatabaseEncryptionService>(); @@ -300,6 +304,7 @@ } var stagedRestorePath = $"{dbPath}.restore_pending"; + bool restoredFromPending = false; // Check if there's a staged restore waiting if (File.Exists(stagedRestorePath)) @@ -307,9 +312,19 @@ app.Logger.LogInformation("Found staged restore file, applying it now"); Console.WriteLine($"[Program] Staged restore found, {stagedRestorePath}"); + // Clear connection pools to release handles opened during startup (e.g. encryption detection) + Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools(); + await Task.Delay(500); + // Backup current database if it exists if (File.Exists(dbPath)) { + // Remove WAL/SHM files - they belong to the old session + var walPath = $"{dbPath}-wal"; + var shmPath = $"{dbPath}-shm"; + if (File.Exists(walPath)) File.Delete(walPath); + if (File.Exists(shmPath)) File.Delete(shmPath); + var timestamp = DateTime.Now.ToString("yyyyMMddHHmmssfff"); var beforeRestorePath = $"{dbPath}.beforeRestore.{timestamp}"; File.Move(dbPath, beforeRestorePath); @@ -319,12 +334,16 @@ // Move staged restore into place File.Move(stagedRestorePath, dbPath); app.Logger.LogInformation("Staged restore applied successfully"); + restoredFromPending = true; } var dbExists = File.Exists(dbPath); // Check database health if it exists - if (dbExists) + // On Windows, skip the health check after a restore swap — the DbContext interceptor + // may not yet match the new encryption state, causing a false corruption diagnosis. + // On Linux this is not an issue as the interceptor is configured before the swap. + if (dbExists && !(OperatingSystem.IsWindows() && restoredFromPending)) { var (isHealthy, healthMessage) = await backupService.ValidateDatabaseHealthAsync(); if (!isHealthy) @@ -759,53 +778,137 @@ // Local function to handle .restore_pending before service registration static void HandlePendingRestore(IConfiguration configuration) { - var connectionString = configuration.GetConnectionString("DefaultConnection"); - Console.WriteLine($"[Program.HandlePendingRestore] Checking for staged restore on database connection string: {connectionString}"); - if (string.IsNullOrEmpty(connectionString)) + // CRITICAL: This runs before ANY service registration or DbContext creation. + // It must compute the correct database path independently of the DI container. + // + // BUG FIXED: Previously this read the path from appsettings.json DefaultConnection, + // which is a fallback path (e.g. Infrastructure/Data/app_v0.0.0.db) that is NEVER + // used by the Electron app. The Electron app stores its database in the OS user-data + // directory (e.g. %APPDATA%\Aquiis\app_v1.1.0.db on Windows). This mismatch meant + // the staged restore was never found and never applied, leaving the app in a broken + // state after an encrypt→decrypt cycle (the DPAPI key is deleted on successful + // decryption, so on the next startup the app saw an encrypted DB with no key and + // displayed the unlock screen indefinitely). + + string dbPath; + + if (HybridSupport.IsElectronActive) { - // Can't proceed without connection string - return; + // Replicate ElectronPathService.GetDatabasePathSync() without needing DI. + var dbFileName = configuration["ApplicationSettings:DatabaseFileName"] ?? "app.db"; + + string basePath; + if (OperatingSystem.IsWindows()) + basePath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Aquiis"); + else if (OperatingSystem.IsMacOS()) + basePath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + "Library", "Application Support", "Aquiis"); + else // Linux + basePath = Path.Combine( + Environment.GetEnvironmentVariable("XDG_CONFIG_HOME") + ?? Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config"), + "Aquiis"); + + Directory.CreateDirectory(basePath); + dbPath = Path.Combine(basePath, dbFileName); + Console.WriteLine($"[Program.HandlePendingRestore] Electron mode — DB path: {dbPath}"); } - - // Extract database path - var builder = new Microsoft.Data.Sqlite.SqliteConnectionStringBuilder(connectionString); - var dbPath = builder.DataSource; - - if (!Path.IsPathRooted(dbPath)) + else { - dbPath = Path.Combine(Directory.GetCurrentDirectory(), dbPath); + // Web / non-Electron: derive path from appsettings.json connection string. + var connectionString = configuration.GetConnectionString("DefaultConnection"); + Console.WriteLine($"[Program.HandlePendingRestore] Web mode — connection string: {connectionString}"); + + if (string.IsNullOrEmpty(connectionString)) + { + Console.WriteLine("[Program.HandlePendingRestore] No connection string found, skipping"); + return; + } + + var csBuilder = new Microsoft.Data.Sqlite.SqliteConnectionStringBuilder(connectionString); + dbPath = csBuilder.DataSource; + + if (!Path.IsPathRooted(dbPath)) + dbPath = Path.Combine(Directory.GetCurrentDirectory(), dbPath); + + Console.WriteLine($"[Program.HandlePendingRestore] Web mode — DB path: {dbPath}"); } - + var stagedRestorePath = $"{dbPath}.restore_pending"; - - // Check if there's a staged restore waiting - if (File.Exists(stagedRestorePath)) + + if (!File.Exists(stagedRestorePath)) { - Console.WriteLine($"[Program.HandlePendingRestore] Found staged restore file, applying it now: {stagedRestorePath}"); - - // Clear SQLite connection pool - Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools(); - - // Wait for connections to close - Thread.Sleep(500); - - // Backup current database if it exists - if (File.Exists(dbPath)) + Console.WriteLine($"[Program.HandlePendingRestore] No staged restore pending at: {stagedRestorePath}"); + return; + } + + var pendingSize = new FileInfo(stagedRestorePath).Length; + Console.WriteLine($"[Program.HandlePendingRestore] Staged restore found: {stagedRestorePath} ({pendingSize:N0} bytes)"); + + // At this point in startup no connections have been opened, but clear pools + // as a safety measure and force a GC pass on Windows to release any lingering + // SQLite native file handles from a previous process that didn't exit cleanly. + Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools(); + + if (OperatingSystem.IsWindows()) + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + Console.WriteLine("[Program.HandlePendingRestore] GC collection complete (Windows handle safety)"); + } + + Thread.Sleep(300); + + if (File.Exists(dbPath)) + { + var currentSize = new FileInfo(dbPath).Length; + Console.WriteLine($"[Program.HandlePendingRestore] Current DB: {dbPath} ({currentSize:N0} bytes) — backing up before replace"); + + // Remove WAL/SHM files — they belong to the outgoing session + var walPath = $"{dbPath}-wal"; + var shmPath = $"{dbPath}-shm"; + if (File.Exists(walPath)) { File.Delete(walPath); Console.WriteLine("[Program.HandlePendingRestore] Deleted WAL file"); } + if (File.Exists(shmPath)) { File.Delete(shmPath); Console.WriteLine("[Program.HandlePendingRestore] Deleted SHM file"); } + + var timestamp = DateTime.Now.ToString("yyyyMMddHHmmssfff"); + var beforeRestorePath = $"{dbPath}.beforeRestore.{timestamp}"; + + try { - var timestamp = DateTime.Now.ToString("yyyyMMddHHmmssfff"); - var beforeRestorePath = $"{dbPath}.beforeRestore.{timestamp}"; File.Move(dbPath, beforeRestorePath); - Console.WriteLine($"Current database backed up to: {beforeRestorePath}"); + Console.WriteLine($"[Program.HandlePendingRestore] Current DB backed up to: {beforeRestorePath}"); } - - // Move staged restore into place + catch (Exception ex) + { + Console.WriteLine($"[Program.HandlePendingRestore] ERROR: Cannot back up current DB — restore aborted."); + Console.WriteLine($"[Program.HandlePendingRestore] {ex.GetType().Name}: {ex.Message}"); + if (OperatingSystem.IsWindows()) + Console.WriteLine($"[Program.HandlePendingRestore] HResult: 0x{ex.HResult:X8} " + + "(0x80070020 = sharing violation / file locked by another process)"); + Console.WriteLine("[Program.HandlePendingRestore] Staged file preserved for next startup attempt."); + return; + } + } + else + { + Console.WriteLine($"[Program.HandlePendingRestore] No existing DB at {dbPath} — placing staged restore directly"); + } + + try + { File.Move(stagedRestorePath, dbPath); - Console.WriteLine("Staged restore applied successfully"); - - // Delete orphaned WAL/SHM files if they exist - var walPath = $"{dbPath}-wal"; - var shmPath = $"{dbPath}-shm"; - if (File.Exists(walPath)) File.Delete(walPath); - if (File.Exists(shmPath)) File.Delete(shmPath); + Console.WriteLine($"[Program.HandlePendingRestore] ✅ Staged restore applied successfully."); + Console.WriteLine($"[Program.HandlePendingRestore] New DB: {dbPath} ({new FileInfo(dbPath).Length:N0} bytes)"); + } + catch (Exception ex) + { + Console.WriteLine($"[Program.HandlePendingRestore] ERROR: Failed to move staged restore into place."); + Console.WriteLine($"[Program.HandlePendingRestore] {ex.GetType().Name}: {ex.Message}"); + if (OperatingSystem.IsWindows()) + Console.WriteLine($"[Program.HandlePendingRestore] HResult: 0x{ex.HResult:X8}"); } } diff --git a/4-Aquiis.SimpleStart/Shared/Services/DatabaseBackupService.cs b/4-Aquiis.SimpleStart/Shared/Services/DatabaseBackupService.cs index 8a16260..b085a81 100644 --- a/4-Aquiis.SimpleStart/Shared/Services/DatabaseBackupService.cs +++ b/4-Aquiis.SimpleStart/Shared/Services/DatabaseBackupService.cs @@ -142,13 +142,6 @@ public DatabaseBackupService( // Try to open connection await _dbContext.Database.OpenConnectionAsync(); - // Try a simple query - var canQuery = await _dbContext.Database.CanConnectAsync(); - if (!canQuery) - { - return (false, "Cannot connect to database"); - } - // SQLite-specific integrity check var connection = _dbContext.Database.GetDbConnection(); using var command = connection.CreateCommand(); diff --git a/4-Aquiis.SimpleStart/electron.manifest.json b/4-Aquiis.SimpleStart/electron.manifest.json index d4c083d..9ea9a6b 100644 --- a/4-Aquiis.SimpleStart/electron.manifest.json +++ b/4-Aquiis.SimpleStart/electron.manifest.json @@ -8,7 +8,7 @@ "--disable-dev-shm-usage" ], "name": "aquiis", - "description": "Desktop property management application for landlords managing up to 9 residential properties", + "description": "Aquiis Property Management", "author": "Aquiis", "singleInstance": false, "environment": "Production", @@ -43,10 +43,17 @@ "category": "public.app-category.business" }, "win": { - "target": "portable", - "icon": "Assets/icon.ico", - "signAndEditExecutable": false, - "artifactName": "${productName}-${version}-${arch}.${ext}" + "target": "nsis", + "icon": "bin/Assets/icon.ico", + "artifactName": "${productName}-${version}-${arch}-Setup.${ext}" + }, + "nsis": { + "oneClick": false, + "perMachine": false, + "allowToChangeInstallationDirectory": true, + "createDesktopShortcut": true, + "createStartMenuShortcut": true, + "shortcutName": "Aquiis" }, "linux": { "target": "AppImage", diff --git a/5-Aquiis.Professional/Program.cs b/5-Aquiis.Professional/Program.cs index ccc3892..bc7d72f 100644 --- a/5-Aquiis.Professional/Program.cs +++ b/5-Aquiis.Professional/Program.cs @@ -11,6 +11,7 @@ using Aquiis.Application.Services; using Aquiis.Application.Services.Workflows; using Aquiis.Infrastructure.Services; +using Aquiis.Infrastructure.Interfaces; using Aquiis.Professional.Data; using Aquiis.Professional.Entities; using ElectronNET.API; @@ -174,10 +175,12 @@ // Database encryption services builder.Services.AddScoped<PasswordDerivationService>(); -builder.Services.AddScoped<LinuxKeychainService>(sp => +builder.Services.AddScoped<IKeychainService>(sp => { // Pass app name to prevent keychain conflicts between different apps and modes var appName = HybridSupport.IsElectronActive ? "Professional-Electron" : "Professional-Web"; + if (OperatingSystem.IsWindows()) + return new WindowsKeychainService(appName); return new LinuxKeychainService(appName); }); builder.Services.AddScoped<DatabaseEncryptionService>(); diff --git a/5-Aquiis.Professional/Shared/Services/DatabaseBackupService.cs b/5-Aquiis.Professional/Shared/Services/DatabaseBackupService.cs index 7fcd96b..c13fcda 100644 --- a/5-Aquiis.Professional/Shared/Services/DatabaseBackupService.cs +++ b/5-Aquiis.Professional/Shared/Services/DatabaseBackupService.cs @@ -142,13 +142,6 @@ public DatabaseBackupService( // Try to open connection await _dbContext.Database.OpenConnectionAsync(); - // Try a simple query - var canQuery = await _dbContext.Database.CanConnectAsync(); - if (!canQuery) - { - return (false, "Cannot connect to database"); - } - // SQLite-specific integrity check var connection = _dbContext.Database.GetDbConnection(); using var command = connection.CreateCommand(); diff --git a/Aquiis.code-workspace b/Aquiis.code-workspace index 487d6ee..33c7cd6 100644 --- a/Aquiis.code-workspace +++ b/Aquiis.code-workspace @@ -1,11 +1,13 @@ { - "folders": [ - { - "path": "." - }, - { - "path": "../../Documents/Orion/Projects/Aquiis" - } - ], - "settings": {} -} + "folders": [ + { + "path": "." + }, + { + "path": "../../Documents/Orion/Projects/Aquiis" + } + ], + "settings": { + "powershell.cwd": "Aquiis" + } +} \ No newline at end of file diff --git a/Documentation/Database-Management-Guide.md b/Documentation/Database-Management-Guide.md index 6aeb6a8..2c1432b 100644 --- a/Documentation/Database-Management-Guide.md +++ b/Documentation/Database-Management-Guide.md @@ -16,6 +16,7 @@ 6. [Database Health Checks](#database-health-checks) 7. [Troubleshooting](#troubleshooting) 8. [Advanced Topics](#advanced-topics) + - [Schema Migrations & Model Optimization](#schema-migrations--model-optimization) 9. [Best Practices](#best-practices) 10. [FAQ](#faq) @@ -959,6 +960,57 @@ Aquiis SimpleStart is designed as single-computer desktop application. Multi-com **Recommendation:** Use one computer as primary. For multi-computer access, wait for Aquiis Professional (web-based, v2.0.0). +### Schema Migrations & Model Optimization + +Aquiis uses **EF Core migrations** to manage schema changes and a **compiled model** to eliminate EF's runtime model-build cost. + +#### EF Core Compiled Model + +On first startup, EF Core normally reflects over all 40+ entity classes to build its internal model — this adds several seconds to every app launch. A **compiled model** pre-builds this at publish time instead, reducing startup time significantly. + +The compiled model lives in `1-Aquiis.Infrastructure/Data/CompiledModels/` and is auto-discovered via an assembly attribute — no code wiring is needed. + +**When to regenerate the compiled model:** + +| Change | Re-run optimize? | +|---|---| +| Add / remove entity or property | ✅ Yes | +| Add / modify relationship or index | ✅ Yes | +| Rename entity or property | ✅ Yes | +| Data-only migration (seed data, no schema change) | ❌ No | +| Bug fix with no model changes | ❌ No | + +> **Note:** If the compiled model is stale, EF Core throws an `InvalidOperationException` at startup — the app will not silently use wrong metadata. + +#### Migration Workflow + +Whenever the entity model changes, run both commands from the solution root: + +```bash +# 1. Add the migration +dotnet ef migrations add <MigrationName> \ + --project 1-Aquiis.Infrastructure \ + --startup-project 4-Aquiis.SimpleStart + +# 2. Regenerate the compiled model +dotnet ef dbcontext optimize \ + --project 1-Aquiis.Infrastructure \ + --startup-project 4-Aquiis.SimpleStart \ + --context ApplicationDbContext \ + --output-dir Data/CompiledModels \ + --namespace Aquiis.Infrastructure.Data.CompiledModels +``` + +Check in both the migration files and the updated `CompiledModels/` folder together in the same commit. + +#### EF Tools Version + +Keep the EF CLI tool current with the runtime version: + +```bash +dotnet tool update dotnet-ef -g +``` + --- ## 📌 Best Practices