Ok I solved my particular issue. My generic repository was built up from ObjectContext instead of the context created by the entity framework designer. As soon as I specified the exact context it all started working. Not sure this is cool though.
Code was:
publicabstractclassBaseRepository<T>
: Repository<T>
where
T : class
{
protectedObjectSet<T>
_objectSet;
protectedObjectContext
_objectContext;
public
BaseRepository(String
stringconn)
{
this._objectContext =
newObjectContext(stringconn);
//changed here to specific context
patterncoder
Member
4 Points
2 Posts
Re: You must write an attribute 'type'='object' after writing the attribute with local name '__ty...
Feb 24, 2012 02:32 AM|LINK
Ok I solved my particular issue. My generic repository was built up from ObjectContext instead of the context created by the entity framework designer. As soon as I specified the exact context it all started working. Not sure this is cool though.
Code was:
public abstract class BaseRepository<T> : Repository<T> where T : class
{
protected ObjectSet<T> _objectSet;
protected ObjectContext _objectContext;
public BaseRepository(String stringconn)
{
this._objectContext = new ObjectContext(stringconn); //changed here to specific context
_objectSet =this._objectContext.CreateObjectSet<T>();
}