Telerik blogs

We have a lot of exciting new features available in the Q3 2011 release of OpenAccess ORM.  Among my favorite additions are our awesome NuGet packages. These packages make it even easier to get started building a domain model using OpenAccess ORM’s fluent mapping, or code first, API.

In this release we have added two NuGet packages to the NuGet repository. When these packages are added to a project, it will be configured automatically to work with Telerik OpenAccess ORM Free Edition.  Let’s take a look at these great new additions to OpenAccess.

The Packages

The OpenAccess.CodeFirst package sets up the project for code first development with OpenAccess.  It will add code to the project file which integrates the project with the OpenAccess enhancer, and it will add all required assembly references. Other than that, the project will look the same as it did before installing the package.

image

The OpenAccess.CodeFirst.Sample package adds a few classes to the project which help get the basic code first project skeleton set up.  It will also create an example entity, and an example mapping configuration for that entity.

image

Installing both packages is extremely useful for both newcomers, and developers already familiar with OpenAccess ORM’s fluent mapping API. After installing both packages, the project will be very similar to what is created when the Telerik OpenAccess Fluent Library Visual Studio project template is used.  However, this requires no install, and the project will be set up to use the OpenAccess Free Edition.  

For more information about code first development with OpenAccess check out this documentation section, and this video series on Telerik TV.

Using the Packages

The first thing we need to do is create a new Class Library Project.  Once the project is created it is time to add the NuGet packages. There are a few ways to install NuGet packages which I will cover briefly, but a great guide for NuGet is also available here.

Method 1

The fastest way to add the first package is to open the package manager console and type:

Install-Package OpenAccess.CodeFirst

Hit enter, and the first package will be installed. 

To install the second package type:

Install-Package OpenAccess.CodeFirst.Sample

Hit enter and the second package will be installed.

Method 2

Another way to install the package is to right click on the references folder in the project, and select Manage NuGet Packages:

image

This will launch the package manager dialog, here you can search for OpenAccess in the upper right, and the packages will show up in the list.  Click the install button on OpenAccess.CodeFirst and it will be added to the project.  

image

Repeat these steps for the second package, which should be listed right below the first package in the search results.

Regardless of the path you took to install the packages, your fluent mapping project is now ready to be used and abused! :) 

But Wait…There’s MORE!

These NuGet packages have an additional benefit aside from being extremely helpful for creating a new fluent mapping model.  When you install the package, all of the files required by OpenAccess are dropped in the packages folder.  This leaves the new project’s OpenAccess version completely independent from the version installed on the system! In fact, I wrote this blog without OpenAccess even installed on my system. :)

Conclusion

We hope you guys find these NuGet packages helpful additions to your toolbox when working with OpenAccess.  Stay tuned for more upcoming blogs about all the great new features we packed into the Q3 2011 release!

More information about the OpenAccess.CodeFirst package is available here, and information about OpenAccess.CodeFirst.Sample package is available here.

Happy Coding!


About the Author

Ivailo Ivanov

 is Team Lead in Telerik Data Access

Comments

Comments are disabled in preview mode.