This question is locked. New answers and comments are not allowed.
hey.
I have a table with a GUID type primary key.
How can i reverse map the table and generate the classs with the GUID primary key? what should i add for the config file to allow generating new guid for insert? I use OpenAccessDataSource with RadGrid.
Please provide a detailed example if you can.
thanks
I have a table with a GUID type primary key.
How can i reverse map the table and generate the classs with the GUID primary key? what should i add for the config file to allow generating new guid for insert? I use OpenAccessDataSource with RadGrid.
Please provide a detailed example if you can.
thanks
7 Answers, 1 is accepted
0
Hi Jaimie,
You can generate the class files as you normally do for each of your other tables as the uniqueidentifier is correctly mapped to Guid by Telerik OpenAccess ORM. What is left is to run the forward mapping wizard and change the Key Generator option for the class from none to GUID. This will let OpenAccess generate and insert guids for your primer keys. Additional information can be found here.
Greetings,
Petar
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can generate the class files as you normally do for each of your other tables as the uniqueidentifier is correctly mapped to Guid by Telerik OpenAccess ORM. What is left is to run the forward mapping wizard and change the Key Generator option for the class from none to GUID. This will let OpenAccess generate and insert guids for your primer keys. Additional information can be found here.
Greetings,
Petar
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marco Tambalo
Top achievements
Rank 1
answered on 08 Jan 2010, 11:54 AM
When creating a new object scope (ObjectScopeProvider.GetNewObjectScope()), the ORM system always displays the error:
Telerik.OpenAccess.RT.sql.SQLException: Invalid object name 'voa_keygen'.
I am using Guid for the Id, Key Generator has been set to GUID and NONE.
What seems to be the problem with this?
Telerik.OpenAccess.RT.sql.SQLException: Invalid object name 'voa_keygen'.
I am using Guid for the Id, Key Generator has been set to GUID and NONE.
What seems to be the problem with this?
0
Hello Marco Tambalo,
The problem is that OpenAccess does not find the mapping where you did specify the Guid key. You have to call AdjustDynamicLoad on the ObjectScopeProvider1 class before you get the first database or have a <reference> entry in the app.config of your application. How do you get the ObjectScopes?
All the best,
Jan Blessenohl
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
The problem is that OpenAccess does not find the mapping where you did specify the Guid key. You have to call AdjustDynamicLoad on the ObjectScopeProvider1 class before you get the first database or have a <reference> entry in the app.config of your application. How do you get the ObjectScopes?
All the best,
Jan Blessenohl
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marco Tambalo
Top achievements
Rank 1
answered on 09 Jan 2010, 03:03 AM
I just use:
IObjectScope scope = ObjectScopeProvider.GetNewObjectScope();
Please note that this is in a WindowsForms project, with the persistent classes/objects in a class library project (the ORM project), and I am using class inheritance hierarchy.
I did not encounter this error in previous projects, with same setup, except that those are WebApplications plus WCF.
BTW, where can I find the AdjustDynamicLoad method?
0
IT-Als
Top achievements
Rank 1
answered on 09 Jan 2010, 08:40 AM
Hi Marco,
The Adjustfor dynamic load is located in the ObjectScopeProvider.cs file... Basically it handcrafts a xml configuration( with the mentioned <reference> tag) to be passed to the Database.Get() method.
Regards
Henrik
The Adjustfor dynamic load is located in the ObjectScopeProvider.cs file... Basically it handcrafts a xml configuration( with the mentioned <reference> tag) to be passed to the Database.Get() method.
Regards
Henrik
0
Marco Tambalo
Top achievements
Rank 1
answered on 11 Jan 2010, 02:07 AM
Yey! It works now!
Thanks!
Thanks!
0
IT-Als
Top achievements
Rank 1
answered on 11 Jan 2010, 07:51 AM
Super. Glad it worked....Please mark the question as answered.
/ Henrik
/ Henrik