I need one method like the GetObjectByKey and the TryGetObjectByKey from the entityframework to use with Linq to oracle there is any alternative or work around?
i'm trying to make a generic metod for mu bll clas to get object by PK because os that i need this method.
GetObjectByKey in linq to oracle
I recommend you to use
to replace GetObjectByKey() and
to replace TryGetObjectByKey().
Code: Select all
ContextInstance.MyEntityCollection.Where(entity=>entity.Id == Id).Single();
Code: Select all
ContextInstance.MyEntityCollection.Where(entity=>entity.Id == Id).SingleOrDefault();
i need a generic one
i need a generic method not like this one
as you can see in this post
http://thedatafarm.com/blog/data-access ... le-entity/
i wish i could do the same to achieve one genic method for all my entities to find one object by key.
as you can see in this post
http://thedatafarm.com/blog/data-access ... le-entity/
i wish i could do the same to achieve one genic method for all my entities to find one object by key.
We will investigate the possibility of adding such methods in one of future builds.
As a temporary workaround you can try Dynamic Linq:
http://weblogs.asp.net/scottgu/archive/ ... brary.aspx
As a temporary workaround you can try Dynamic Linq:
http://weblogs.asp.net/scottgu/archive/ ... brary.aspx
This link has a SelectByPK() method which can be carefully adapted
http://www.c-sharpcorner.com/UploadFile ... SinCS.aspx
http://www.c-sharpcorner.com/UploadFile ... SinCS.aspx