lundi 16 février 2015

Generic Repository Pattern IEntity property case sensitivity

I am using Generic Repository Pattern in my application. I am trying this post http://ift.tt/1t8Ntac. The question is, database code generation tool (code first from existing database) generated following models:



[Table("TableName1")]
public partial class TableName1 : IEntity
{
public int ID { get; set; }

[StringLength(50)]
public string Name { get; set; }

::::::::
}

[Table("TableName2")]
public partial class TableName2 : IEntity
{
public int Id { get; set; }

[StringLength(50)]
public string Name { get; set; }

::::::::
}


And I just applied IEntity in above database models, but there is problem in TableName2 class because IEntity interface has 'ID' property not 'Id'. Here is the one



public interface IEntity
{
int ID { get; }
}


So how to convert this IEntity to accepts properties without looking at cases? I need easiest possible solution if I don't want to create separate independe new models for each table?


Aucun commentaire:

Enregistrer un commentaire