Cannot Find Persistent Class

3 posts, 0 answers
  1. Michael Luna
    Michael Luna avatar
    9 posts
    Member since:
    May 2007

    Posted 28 Sep 2009 Link to this post

    I am currently building a multi-tiered application and am at the DAL/BL stage.  I have tables in a database that I want to represent as b.o.'s, but all database access I want to handle through stored proc's.  So I want to use the ORM to map out b.o.'s for each of my tables, but I want to separately use the ORM to also generate methods that call the stored proc's I need.  I did all this last week and everything worked fine.

    I later decided I wanted the b.o.'s in a separate project alongside the business layer, calling it the "value objects" project.  I killed off all the b.o.'s from the DAL and re-used OpenAccess to code-gen them in the VO project.  I then added a reference from the DAL to the VO's.  It seems pretty simple to me.  Yet, now when I try to run my unit tests I get the following error:

    Telerik.OpenAccess.Exceptions.InvalidOperationException: No persistent class could be found.
    To define persistent classes use the [Persistent] attribute at the class level.
    If multiple projects are used additional references must be made in the configuration file.
    To update the required references use 'Update Config References' from the OpenAccess menu.

    This exception occurs when I try to get the scope at the top of every one of my stored proc accessor methods.  Here is one example:

            public bool RetrieveAttributes(EdiReceiveSender sender) 
                IObjectScope scope = Database.Get("connFfops").GetObjectScope(); 
                IQueryResult retval =  
                    StoredProcedures.RetrieveAttributes(scope, sender.UserName, sender.ForwarderCode, sender.Password); 
                return false; 

    The "EdiReceiveSender" is a ORM-generated class in my v.o. project.  In my unit test I instantiate one, fill it, then pass it off to this method in the DAL.  Again, all this worked just fine when my b.o.'s and sproc accessors were in the DAL together.

    I'd greatly appreciate any help.

  2. Michael Luna
    Michael Luna avatar
    9 posts
    Member since:
    May 2007

    Posted 28 Sep 2009 Link to this post

    I don't know what changed, but for some reason this error just stopped coming up.  When I run my tests now, they run fine.  I did not change anything that I know of.  Strange.

    So as Gilda Radner used to say, "NEVER MIND!"
  3. DevCraft banner
  4. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 30 Sep 2009 Link to this post

    Hello Michael Luna,

    The error that you reported appears when there are no persistent classes in the assembly, but the settings Enhancing and Update Database are set to true. These settings are added to the project file by the Enable Project wizard. When Enhancing is set to true, the Enhancer, used by Telerik OpenAccess ORM tries to read and process the compiled .NET assemblies for adding persistence capability. Update Database means that the VSchema tool from OpenAccess is started during compilation and it creates or updates the database schema so it resembles the current persistent model. In order to avoid the error in your case, you should set these settings to false.

    Damyan Bogoev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top