Adding Open Access to Sitefinity

3 posts, 0 answers
  1. Gabe Sumner
    Gabe Sumner avatar
    10 posts
    Member since:
    Sep 2007

    Posted 22 Nov 2008 Link to this post

    I'm attempting to use Open Access inside of a Sitefinity web site.  I have done the following:

    I created a ~/App_Code/TestPersist.cs file with the following code:

    /// <summary>  
    /// Summary description for TestPersist  
    /// </summary>  
    [Telerik.OpenAccess.Persistent]  
    public class TestPersist  
    {  
        public string FirstName;  
        public string LastName;  
     
        public TestPersist()  
        {  
     
        }  
    }  
     

    I then added the following section to my ~/web.config file:

      <openaccess xmlns="http://www.telerik.com/OpenAccess">  
        <references> 
          <reference assemblyName="App_Code" /> 
        </references> 
        <connections> 
          <connection id="DatabaseConnection1">  
            <databasename>Sitefinity</databasename> 
            <servername>(LOCAL)\SQLEXPRESS</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <connectionParams>AttachDbFilename=AttachDBFilename=|DataDirectory|Sitefinity.mdf</connectionParams> 
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname> 
          </connection> 
        </connections> 
        <backendconfigurations> 
          <backendconfiguration id="mssqlConfiguration" backend="mssql">  
            <mappingname>mssqlMapping</mappingname> 
          </backendconfiguration> 
        </backendconfigurations> 
        <mappings current="mssqlMapping">  
          <mapping id="mssqlMapping" /> 
        </mappings> 
      </openaccess> 

    I then attempted to execute the following code:

        protected void Page_Load(object sender, EventArgs e)  
        {  
            TestPersist hello = new TestPersist();  
     
            hello.FirstName = "Gabe";  
            hello.LastName = "Sumner";  
     
            IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();  
        }  
     

    I get the following error:

    Telerik.OpenAccess: No enhanced assembly has been found for meta-data construction. This may be caused by a missing app.config file (use app.config as embedded resource then) or by an insufficient references section in the configuration file (add the referenced enhanced assemblies there too) or by a wrong enhancement setting; please check your configuration.

    I have a reference added for "App_Code".  This is the assembly where (I think) my persistent classes reside.  I'm sure I'm doing something stupid.  Any advice?

    Gabe Sumner
    http://www.goondocks.com/
  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 24 Nov 2008 Link to this post

    Hi Gabe Sumner,

    The problem is that OpenAccess needs to enhance the compiled assembly to add lazy loading and change tracking to the model. This is a post build step that is only available for projects with a real assembly as output. This is not the case with your web project.

    What you have to do id to add a class library project that contains the persistent classes and reference this from your web project.

    Greetings,
    Jan Blessenohl
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Gabe Sumner
    Gabe Sumner avatar
    10 posts
    Member since:
    Sep 2007

    Posted 12 Dec 2008 Link to this post

Back to Top