We are looking at Dapper to simplify our mapping logic. It looks pretty promising except for one thing. We use custom types for our ids. For example:
public class MyEntityIdentity
{
public int IdentityValue { get; }
public MyEntityIdentity(int identity) { IdentityValue = identity; }
}
public class MyEntity
{
public MyEntityIdentity Identity { get; set; }
int Prop1 { get; set; }
string Prop2 { get; set; }
bool Prop3 { get; set; }
}
With the SQL table looking something like:
create table [dbo].[MyEntity] (
my_entity_id int identity(1,1) NOT NULL,
prop1 int NULL,
prop2 varchar(100) NULL,
prop3 bit NOT NULL
CONSTRAINT PK_MyEntity PRIMARY KEY CLUSTERED (my_entity_id ASC)
)
How can we map the "Identity" property?
int
. IMO, you are overcomplicating your model for little gain. – Amy Nov 16 '18 at 16:11