I'm trying out this ORM & new to this. I have following code:

IObjectScope scope = Database.Get("MyConnection").GetObjectScope();

try
{
   scope.Transaction.Begin();
   Reading r = new Reading();
   r.ReadingURL = reading.ReadingURL;
   r.IsActive = true;
   scope.Add(r);
   scope.Transaction.Commit();
}
finally
{
   scope.Dispose();
}

When I run this I get following error on "Add":

Telerik.OpenAccess.Exceptions.InvalidOperationException: Class 'WritingChallenge.Reading' is persistent but not known in this context.

It seems for some reason database connection is lost? I'm not sure what is the issue here.

有帮助吗?

解决方案

The issue here is that the model that was connected to the WritingReplacementConnection was having no information about the WritingChallenge.Reading type.

Did you specify a mappingConfiguration that included this type?

You can also ask this kind of questions in the forums at Telerik Forums - .NET ORM.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top