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
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.
Stephen Forte sits on the board of several start-ups including Triton Works. Stephen is also the Microsoft Regional Director for the NY Metro region and speaks regularly at industry conferences around the world. He has written several books on application and database development including Programming SQL Server 2008 (MS Press).
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.