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

[Solved] Tutorial for Domain Model Forward mapping?

3 Answers 146 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
sitefinitysteve asked on 29 Nov 2010, 02:48 AM
Is there a tutorial somewhere for basics on forward mapping with the domain model?

I need to know how to
1) Get new properties in the model created in the DB **EDIT** Figured this one out, it's the choice in the dropdown in the Update Database...I was generating new instead of Altering.
2) Change generated column names (posted in another forum on this one too)
3) Set the Int ID PK columns to be backend Autogenerated
4) Default values on the properties...do I use sql commands like getdate() or C# DateTime.Now?
5) String size (defaults to 255, what if I need it MAX)
6) Change model namespace after creation **EDIT** Edit the rLinq directly seems to fix this, can we get it added to the Settings form or model properties...I mean I see it there, but it's grayed out?
7) I see this blog post which I guess is what I need?  But I created it by plopping on Meta Class items from the toolbox and linking associations...did I do all that work for nothing?

Like once i use the wizard to update database from Model, do I then Update Model from Database so the new tables showup in the Model Schema Explorer?

3 Answers, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 30 Nov 2010, 05:27 PM
Hello Steve,

2) Please follow the answer from the other forum thread (regarding columns names).

3) You could set the Identity Mechanism of a class by following those steps:
1.   Select the class from the designer;
2.   Click F4 to open the Properties grid;
3.   Set the Identity Mechanism to Backend Calculated;

4) You could use getdate() as default value for the column on the sql server but in this case you should set the corresponding property as PersistentReadOnly. From the Properties grid for this property set the Kind setting to PersistentReadOnly. Otherwise you could set the default value for the property in the default constructor of the class using DateTime.Now.

5) You could set the column length from the Table Editor. If the length is set to 0 the runtime will automatically set it to the provided string’s length.

7) You could use the proposed approach (from the thread regarding columns names) with default mapping.

Best wishes,
Damyan Bogoev
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 30 Nov 2010, 05:30 PM
Thanks for the reply

So have I just been doing this all wrong then?...I shouldn't be visually designing my model, I should be adding new tables through the Explorer pane?
0
Damyan Bogoev
Telerik team
answered on 02 Dec 2010, 06:47 PM
Hello Steve,

You could continue designing your domain model using the visual designer. But if you want to control the naming generation of columns and tables you should use the Table Editor:
-   create a persistent class;
-   apply default mapping for this class;
-   use the Table Editor to adjust the column and table names;
Improvements in the naming generation for relational items are on our to-do list for Q1.

Kind regards,
Damyan Bogoev
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Damyan Bogoev
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or