Telerik blogs

In past releases, we included an example in our SDK that showed customers how to work with Dynamic Data projects when using OpenAccess ORM.  The process was not as straightforward as we would have liked, but it worked.  In this release we are excited to announce that we have greatly simplified this process by adding wizards, and a new provider, allowing OpenAccess ORM to work directly with .Net 4.0 Dynamic Data Web Applications, and Web Sites.

Getting Started

To use this new functionality, the first thing you need to do is build a Telerik OpenAccess ORM domain model.

Once the domain model is built, create a new project using the ASP.NET Dynamic Data Entities Web Application project template.  Also, be sure that the project is targeting .Net 4.0 using the drop down box in the Add New Project dialog.

image

Now that we have the Dynamic Data Application, we need to add references to:

  • the project containing the OpenAccess Domain Model
  • Telerik.OpenAccess.dll
  • Telerik.OpenAccess.Web.40.dll
  • Telerik.OpenAccess.35.Extensions.dll

Also copy the connection string information from the app.config in the OpenAccess model project, and paste it into the web.config of the dynamic data application.

The next step is to tell the dynamic data application how to use the OpenAccess Context.  To do this, open the global.asax file, and paste the following code at the beginning of the RegisterRoutes static method:

Using the Wizards

With the references, connection string, and context configuration in place, we are ready to run the new OpenAccess Dynamic Data Wizards.

To launch the wizards, expand the Telerik menu in Visual Studio, point to OpenAccess ORM, and then click Dynamic Data Wizard.

image

This will launch the new wizard, which will walk you through configuring how your entities are exposed in the dynamic data application.

In the first screen, select the type of mapping you are using for your domain model.  If you are using the Visual Designer, select .Rlinq File.  If you are using the fluent mapping API, select Fluent Metadata Source.  The middle option, OpenAccessContext, would be used if you defined an OpenAccessContext in a project, separate from the model project. 

image

In the next screen you can configure which entities will be exposed through the application using the checkboxes in Enable column .  In addition, you can specify which operations are available for an entity using the Enable (Edit/Delete/Insert) checkboxes.  The Choose Fields column allows you to customize which fields will be returned for an entity.  By default all columns will be available.

image

The final screen, allows developers to control the modules/pages that will be created for each entity.  At this point we can click Finish and the pages for our dynamic data site will be added to the application.

image

Once the pages are added, you can see them by opening the solution explorer, and navigating to DynamicData/CustomPages/EntityName, as show below.  The image below shows a detail, list, insert, and edit page was created for the car entity.

image

At this point you application is ready to run! :)

image

 

To see this code in action, check out the video on Telerik TV.

Wrap Up

I hope this helps you get started using OpenAccess ORM in Dynamic Data Applications, and make stay tuned to the blogs to see more information about all the awesome new Q3 2011 features.  Also, make sure to register for the upcoming Q3 release webinars if you have not done so!

Happy Coding!


About the Author

Ivailo Ivanov

 is Team Lead in Telerik Data Access

Comments

Comments are disabled in preview mode.