0

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.

DAK
  • 1,395
  • 4
  • 22
  • 35

1 Answers1

1

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.

enb081
  • 3,831
  • 11
  • 43
  • 66
Tom67
  • 153
  • 4
  • could you please put some light on "mappingConfiguration". My telerik generated classes are not part of model but my model class is extended to Telerik class. I went with this approach so I can have clear separation between the two in case there is database update in the future. This won't effect my custom methods – DAK Sep 26 '12 at 13:42
  • For your information: the provided link seems to be dead. – Dominique Jun 07 '23 at 11:04