Open Closed

Unique Name set in Object and Respective #769

hasan created

Hello Sir

This could be the simplest question but would like to ask you how to do that

I have a object called Brand

    public class Brand : FullAuditedEntity,IMustHaveTenant
        public virtual string Name { get; set; }

        public virtual bool IsActive { get; set; }
        public virtual int TenantId { get; set; }

I want to set the Name as Unique. How to achieve that in ABP ZERO

I am able to see that in RoleService that it throws the error at the place in Method CreateRoleAsync CheckErrors(await _roleManager.CreateAsync(role));

Can you please let me know how to achieve that ?

2 Answer(s)
  • 0
    hasan created

    I have read about Domain Services

    <a class="postlink" href=""> ... n-Services</a>

    I guess we should have business validation at this place.

    Could you please tell me where to keep the file (Which Project) ?


  • 0
    ismcagdas created
    Support Team

    You can put your file in Core project since it is a domain service. You can also add an unique index on Name field of your entity.