RepositoryPrimaryKey attribute with Guid

18 views
Skip to first unread message

ahsan.al...@gmail.com

unread,
Feb 18, 2015, 10:47:58 AM2/18/15
to sharpre...@googlegroups.com
Hi,

I am using RepositoryPrimaryKey attribute as follows:

public class DummyEntity : RepositoryEntityBase
{
[RepositoryPrimaryKey]
public Guid DummyEntityId { get; set; }
...

It seems "RepositoryFactory.GetInstance<DummyEntity>()" doesn't work for Guid. It defaults to "int".

I'm forced to use RepositoryFactory.GetInstance<DummyEntity, Guid>()"

Is this a limitation?

Thanks
Ahsan

Jeff Treuting

unread,
Feb 18, 2015, 9:49:59 PM2/18/15
to ahsan.al...@gmail.com, sharpre...@googlegroups.com
I'm not sure there is a good way around that since type returned from the factory instance needs to be known so that the methods like Get() that take the type of the PK. It would be cool if there was a way to make that more dynamic but I'm not sure there is an easy way to do it. But I might be missing something as I haven't fully thought it through.

________________________________________
From: sharpre...@googlegroups.com <sharpre...@googlegroups.com> on behalf of ahsan.al...@gmail.com <ahsan.al...@gmail.com>
Sent: Wednesday, February 18, 2015 7:47 AM
To: sharpre...@googlegroups.com
Subject: [SharpRepository] RepositoryPrimaryKey attribute with Guid

Hi,

Is this a limitation?

Thanks
Ahsan

--
You received this message because you are subscribed to the Google Groups "SharpRepository" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharpreposito...@googlegroups.com.
To post to this group, send email to sharpre...@googlegroups.com.
Visit this group at http://groups.google.com/group/sharprepository.
To view this discussion on the web visit https://groups.google.com/d/msgid/sharprepository/4b3000f2-77b3-484f-856c-18e2d674a968%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages