Starts in:
1 DAY
17 HRS
0 MIN
12 SEC
Starts in:
1 D
17 H
0 M
12 S
Open Closed

set ID #4819


User avatar
0
shobhit created
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I have following domain class. i have to create a instance and set the Id property. How i can set Id property. (I understand Id is Private so what will be alternate).

public class MyCloass : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
      [NotNull]
        public virtual string Detail { get; set; }

        [NotNull]
        public virtual string Title { get; set; }

}

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can consider:

    public class MyCloass : FullAuditedAggregateRoot<Guid>, IMultiTenant
    {
          [NotNull]
          public virtual string Detail { get; set; }
    
          [NotNull]
          public virtual string Title { get; set; }
          
          public void SetId(Guid id)
          {
             Id = id;
          }
    
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06