This is a migrated thread and some comments may be shown as answers.

Adding Open Access to Sitefinity

2 Answers 454 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gabe Sumner
Top achievements
Rank 1
Gabe Sumner asked on 22 Nov 2008, 07:00 PM

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 Answers, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 24 Nov 2008, 10:51 AM
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.
0
Gabe Sumner
Top achievements
Rank 1
answered on 12 Dec 2008, 11:22 PM
Tags
General Discussions
Asked by
Gabe Sumner
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Gabe Sumner
Top achievements
Rank 1
Share this question
or