Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "a. h."

Answer

Thank you.

Answer

<cite>hikalkan: </cite> Hi,

You can change mapped column name with two options:

  • You can override Id property and use a Column attribute.
  • Or you can override OnModelCreating and set column name. See: <a class="postlink" href="https://msdn.microsoft.com/en-us/data/jj591617.aspx#1.1">https://msdn.microsoft.com/en-us/data/jj591617.aspx#1.1</a>

These are all EF stuff.

Have a nice day.

They are and they aren't.

I have also had a bugger of a time with this.

E.g Using ABP... I have had to do things to work around the issue of not having an "Id"

public Client : Entity {
  [Key]
  public virtual int ClientID {get;set;} 
}

...
OnModelCreating(DBModelBuilder modelBuilder) {
  modelBuilder.Entity<Client>().Ignore(e => e.Id);
}

...
IClientRepository : DBRespositoryBase<Client>, IClientRepository {

  public virtual Client GetByID (int ClientID)
        {
            Client client = FirstOrDefault(agent => client .ClientID == ClientID);

            if (client == null)
            {
                throw new Exception("Client not found: " + ClientID);
            }
            return Client;
        }
}

ClientDTO : EntityDTO {
  public ClientDTO (int ClientID) {
      Id = ClientID;
  }
}

etc...

I can't use the IRepository's Get statement. Can't use AutoMapper... It is very much a ABP issue for me, unless I'm doing it wrong...

Can you outline a quick to-do of what needs to be done to completely implement a table that doesn't use an Id in ABP? :D

Showing 1 to 2 of 2 entries