This is a migrated thread and some comments may be shown as answers.

Some questions about ORM

3 Answers 80 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
M Kumar
Top achievements
Rank 1
Iron
Veteran
M Kumar asked on 07 Sep 2013, 03:33 AM
hi

i am now to open access ORM, i have few questions about open access orm

1. can i add dynamically created table in open access orm dynamically, mean i add 5 tables in open access orm deploy in to customer place, if customer create 2 extra tables dynamically how to add these 2 tables to open access orm dynamically ?

2. can i access data with dynamic table name i mean 
Dim tablename = "Documents"
Dim Doc = ctx.tablename

3 Answers, 1 is accepted

Sort by
0
Kristian Nikolov
Telerik team
answered on 09 Sep 2013, 11:46 AM
Hello,

You can dynamically add and access database tables by using Artificial Types, a feature of Telerik OpenAccess ORM which allows you to extend your model with persistent types defined at runtime. Note that in order to take advantage of Artificial Types you will have to use Fluent Mapping.

Please refer to our Samples Kit where under the API node, you can find a sample called Consuming Types Defined During Runtime. It illustrates how to create, update and delete artificial types and their properties as well as how to create, read, update and delete artificial entities.

Regards,
Kristian Nikolov
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
0
M Kumar
Top achievements
Rank 1
Iron
Veteran
answered on 17 Sep 2013, 05:13 AM
Hi
i didn't mean totally dynamic
ok i can create new table with the help of simple sql query
my question is
1. can i access newly created sql server table via ORM

how to query the newly created table
Dim tablename = "Documents"
Dim Doc = ctx.tablename


how to combine query
mean how to query this newly created table with previously created table with relationship

i already told you i have no idea about table name and column names then how i going to create fluent mapping
can you give simple example?

if i can not achieve the required feature i think better i stop searching this ORM
0
Alexander
Telerik team
answered on 18 Sep 2013, 03:31 PM
Hello M Kumar,

The Artificial types functionality that my colleague recommended is exactly what you need in this case. With artificial types you can create persistent classes dynamically and access their properties using an entirely string-based API.

There is one requirement though, which is that your initial (non dynamic) model should also be defined using our fluent API. This is the easiest and most powerful way to extend the model later with artificial types. Please note that you could create your model using the Telerik OpenAccess Fluent Library template, which would generate the initial needed fluent code automatically from your database. Afterwards you need to add only the code for creating artificial types at runtime.

For more information please have a look at the links provided in the previous post and feel free to contact us again if you face any difficulties.

Regards,
Alexander
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
Tags
Getting Started
Asked by
M Kumar
Top achievements
Rank 1
Iron
Veteran
Answers by
Kristian Nikolov
Telerik team
M Kumar
Top achievements
Rank 1
Iron
Veteran
Alexander
Telerik team
Share this question
or