Telerik blogs
  • Productivity

    Forward mapping a model with associations

    In this post we will discuss how to add associations in a forward mapping scenario with our Visual Designer. We will start from scratch and build a model with two entities – Category and Product where each Product belongs to at most one Category (a zero-or-one-to-many relationship from the categories to the products). 1. In the solution explorer right-click your project (where you want to add the persistent types) and select OpenAccess -> Add Domain Model. We will create an empty model.     2. The next step is to create a new database which we will name WarehouseDB. Creating a brand new database can be achieved...
    May 27, 2021 4 min read
  • Release

    The new Telerik OpenAccess Schema Update wizard

    One of the new features of Telerik OpenAccess ORM Visual designer is the forward mapping wizard that can be used to update the database schema from the model. Yes it is true! With just few clicks you are able to generate and execute either a schema definition or schema update script that will alter you database schema. First you will need to open our Schema Update Wizard. You can do this by either right clicking in the schema explorer or in the model explorer: the command is named Update Database from Model… This will open the following page: On the first page you...
    May 27, 2021 3 min read
  • Productivity

    Custom Code Generation

    The good thing about the code generation is that you can easily modify it to suite your needs. Today I will show you how to modify the code generation template so that it generates string properties that HtmlEncode and HtmlDecode the values in their respective setter and getter. The desired outcome will look like :  private string firstName;   public virtual string FirstName  {      get     {         return HttpContext.Current.Server.HtmlDecode(this.firstName);     }     set     {         this.firstName = HttpContext.Current.Server.HtmlEncode(value);     } } You can achieve this in a couple of steps. First we need to locate the T4 templates that OpenAccess uses. The C# templates are usually located under C:\Program Files (x86)\Telerik\OpenAccess ORM\dsl\CodeGenerationTemplates\CSharp. Note that it would...
    May 27, 2021 2 min read
  • Productivity

    Usability tips with OpenAccess

    As solutions get more complicated every day so does the domain model. Navigating in the designer can become quite frustrating if you have a rather large database with 100+ tables. There is however a light at the end of the tunnel.  There are a few often overlooked features of the designer that can make your life easier when dealing with large models.  First of all you should get familiar with search bar on top of the Model Explorer and the Schema Explorer. It is the easiest way to find a class or a table by its name. So what do you do...
    May 27, 2021 2 min read
  • Release

    New Fetch Optimization API

    In this blog post we will introduce the new intuitive and powerful Fetch Optimization API. Users familiar with the LINQ to SQL data load options will feel very comfortable with our API. If you don’t have a clue what this is all about, here we will give an overview of the basic concepts behind the usage of fetch strategies. In short, fetch strategies help you optimize your retrieval of objects from the database. They allow you to specify properties in a persistent object that are retrieved together whenever you invoke a call to the persistent object. Let’s consider the following example...
    May 27, 2021 4 min read