What method should I follow? I need more field.
Here is an example

Geschrieben: 24 October 2024 - 20:59
Geschrieben: 17 November 2024 - 10:52
I preferred to create a new table with details for address...
internal class AddressDetailsMap : IEntityTypeConfiguration<AddressDetails> { public void Configure(EntityTypeBuilder<AddressDetails> builder) { builder .HasOne(ad => ad.Address) .WithOne() .HasForeignKey<AddressDetails>(ad => ad.AddressId) .OnDelete(DeleteBehavior.Cascade); } } public class AddressDetails: BaseEntity { public int AddressId { get; set; } public int AddressType { get; set; } // Individual or Corporate public string IdentityNumber { get; set; } public string Company { get; set; } public int TaxNumber { get; set; } public string TaxOffice { get; set; } public bool EInvoice { get; set; } private Address _address; public Address Address { get => _address ?? LazyLoader.Load(this, ref _address); set => _address = value; } }
Geschrieben: 18 November 2024 - 16:43
altematively updated with migration.
So how do you go about getting up the pages?
[MigrationVersion("2024-01-01 00:00:00", "Address: Updated")] internal class Initial : Migration, IDataSeeder<SmartDbContext> { public bool RollbackOnFailure => false; public bool AbortOnFailure => false; private ICurrentDbContext currentDbContext { get; set; } public DataSeederStage Stage => DataSeederStage.Early; public override void Up() { var address = nameof(Address); if (Schema.Table(address).Exists()) { if (!Schema.Table("Address").Column("AddressType").Exists()) { this.Create.Column("AddressType").OnTable("Address").AsInt32().WithDefaultValue(0); } if (!Schema.Table("Address").Column("InvoiceType").Exists()) { this.Create.Column("InvoiceType").OnTable("Address").AsInt32().WithDefaultValue(0); } if (!Schema.Table("Address").Column("IdentityNumber").Exists()) { this.Create.Column("IdentityNumber").OnTable("Address").AsString(11).Nullable(); } if (!Schema.Table("Address").Column("TaxNumber").Exists()) { this.Create.Column("TaxNumber").OnTable("Address").AsString(10).Nullable(); } if (!Schema.Table("Address").Column("TaxOffice").Exists()) { this.Create.Column("TaxOffice").OnTable("Address").AsString(100).Nullable(); } if (!Schema.Table("Address").Column("EInvoice").Exists()) { this.Create.Column("EInvoice").OnTable("Address").AsBoolean().WithDefaultValue(0); } } } public override void Down() { } public Task SeedAsync(SmartDbContext context, CancellationToken cancelToken = default) { return Task.CompletedTask; } }
Smartstore (English) →
Customize & Extend Smartstore →
newbee: address validation pluginEröffnet von yisman - 26 Feb 2018 ![]() |
|
![]()
|