Yesterday Telerik released the Q2 version of OpenAccess ORM as well as the rest of the product line. Yesterday (Part I) I showed you the menus, Data Service Wizard, and new XAML templates. Today I will show you round tripping. Next week I will talk about RIA Services and model first.
OpenAccess Q2’s new LINQ implementation and Visual Designer introduces database round tripping. Now you can make changes in your model and persist them to your database table. (You always had the ability to make a database schema change and refresh your model.) Let’s see this feature in action. The Model Schema Explorer gives you a view of your mapped entities. If you right click on a table you can choose Edit Table from the context menu to begin editing your entity.
This brings up the Edit Table.. dialog where you can insert, edit, and delete columns and set metadata such as data types and nullable.
I’ll go ahead add a CurrentCustomer column as a bit to indicate if the customer is current or not. That is all there is to it, so I will right click on my model and select Update Database From Model as shown here.
This brings up the Schema Update Wizard. This wizard will allow you to execute the script right away or generate it and save it for later. It will also give you the choice between making an update (alter table) compared to a create (create table). I’ll decide to make an update and execute it now and click next.
After I tell the wizard what table to update the database with (and make sure you have mapped your new column to the model and recompiled the project before running the wizard), you are presented with the script and given the ability to save the script, execute it, or copy it to the clipboard.
Being a database geek, I am only going to copy to the clipboard the part of the code that I need, the ALTER TABLE command with the ADD column and run that against my SQL Server. I could let OpenAccess run the code for me, but as I said, I am a database geek and like complete control. The tool gives you whatever level of control you desire. Once you run the TSQL either via the wizard or by hand, the process is complete.
Page rendered at Wednesday, 26 July 2017 14:49:27 (Eastern Daylight Time, UTC-04:00)
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in anyway.