Go Back
  • Using OpenAccess Persistent Objects in Sitefinity

    To use an OpenAccess persistent class in Sitefinity, first install OpenAccess and create a new Class project in Visual Studio.  Next, create the objects you want OpenAccess to persistNote: You cannot create your persistent objects in ~/App_Code.

    Make your Persistent Class part of your Solution

    Open your Sitefinity web site in Visual Studio by clicking File -> Open Web Site.  Navigate to the directory of your Sitefinity web site and click Open.

    Sitefinity in Solution Explorer

    Click File -> Add -> Existing Project to make your Persistent Class part of your current project.  (Note: alternately you can add a reference to your persistent class' DLL or simply copy the DLL file to your web site's ~/bin folder.)

    Adding an Existing Project to Sitefinity

    Navigate to the location of your persistent class' project file, select the file and click Open.

    Select Existing Project to add to Sitefinity

    Your persistent class should now become part of the Solution Explorer.

    Existing Project is added to Sitefinity

    Add a Reference ...

  • Creating a Persistent Object with OpenAccess

    In my last blog post I described how to install Telerik's OpenAccess ORM Express and create a new OpenAccess-enabled Visual Studio project.  Below we'll use the environment we previously setup to create a persistent object that we'll later use in Sitefinity.

    Before proceeding to the steps below you MUST work through all the steps found in my previous blog post.

    Create your first Persistent Class Item

    To create a new persistent object right-click on your project (MyClass) in Visual Studio's Solution Explorer and click Add -> Add New Item.

    add-new-item

    For the item type choose Class and type Customer.cs for the class file name.

    add-new-item-details

    Define your Object

    We now have an empty Customer class and must define the properties that will exist.  Let's start with something really simple:

    using System;
    
    namespace MyClass
    {
         public  class Customer
        {
             private  string _firstname;
             private  string _lastname;
    
             public  string FirstName
            {
                ...
  • Getting Started with OpenAccess

    orm As mentioned, Telerik's OpenAccess ORM will be a big part of Sitefinity 4.0.  Like RadControls for AJAX and RadControls for Silverlight, OpenAccess be available to Sitefinity developers and used within Sitefinity projects. 

    Sitefinity is designed to be a web development framework, as well as a CMS.  The OpenAccess ORM addresses the crucial data-access layer (DAL) of web applications.  Below we'll examine how to install OpenAccess and enable a new project to use OpenAccess.

    Install OpenAccess ORM Express

    To get started, download OpenAccess ORM Express.  This free version of OpenAccess only works with free database servers such as MySQL & SQL Express, but is otherwise fully functional.  The full version of OpenAccess ORM supports several additional databases.

    Extract the setup files from the downloaded zip file and run the setup.exe file.  Click through the installation screens and accept the default options for each step.

    install

    Understanding the Basics...

  • Introducing Open Access

    orm Just to bring everyone up to speed, Telerik acquired Vanatec in October 2008.  With this acquisition Telerik also added Open Access ORM to our developer tools portfolio.

    What is an ORM?

    ORM is an acronym for object relation mapping.  At a basic level, an ORM helps us store & retrieve objects.  For many of us, an ORM simply prevents us from writing a lot of SQL.

    For example, let's say we have a Customer class:

    Customer customer=newCustomer();
    customer.FirstName ="Mike";
    customer.LastName ="Walsh";

    An ORM allows us to do something like this:

    customer.Save();

    And behind the scenes it would automatically generate & execute the SQL needed to persist this object:

    INSERT INTO Customers(FirstName,  LastName)  VALUES  ('Mike',  'Walsh')

    I'm simplifying a lot, but this will give you the general idea.  ...

  • Use SQL Express without Attached Files

    When you install a fresh copy of Sitefinity you're presented with a few database choices:

    set_database

    One of these options is SqlExpress. SQL Express is a free scaled-down version of Microsoft's SQL Server. For many small to medium web sites, SQL express will be sufficient for the web site's database needs. However, it's good to be aware of the limitations.

    When you select SqlExpress during the Sitefinity installation a database file will be created in your web site's ~/App_Data folder:

    sqlexpress_database_file

    This is really easy to setup and no additional setups are needed. Sitefinity attaches the database file during startup and your web site is now ready to go.

    However, when Sitefinity is running, this database file is locked. This will limit your ability to interact with the database outside of Sitefinity. Exporting or browsing data, for example, will require you to shut-down the web server.

    The good news is ...