This is a migrated thread and some comments may be shown as answers.
Fluent API - StringPropertyConfiguration - Unlimited length
7 Answers 79 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roland
Top achievements
Rank 1
Roland asked on 02 Dec 2010, 09:58 PM
How do I specify that particular string is supposed to be unlimited using fluent mapping configuration ?

7 Answers, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 03 Dec 2010, 05:42 PM
Hi Roland,

 You can do so by specifying the database type this column is mapped to. This can be done by using the HasColumnType method of the Fluent Mapping API. For example if you are using MS SQL Server you will have to input "nvarchar(MAX)" as its type.

I hope this is helpful, if you have any other questions or face further trouble please let us know.

Regards,
Serge
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
0
Roland
Top achievements
Rank 1
answered on 03 Dec 2010, 05:48 PM
How this will work when I switch to SQLite or oracle or any other db?

0
Serge
Telerik team
answered on 06 Dec 2010, 06:09 PM
Hi Roland,

 At the time being there is no straight forward way of specifying this, we will be working on support for default values for the container which is a feature that will solve this issue. However for the moment there is an easy workaround you can use. 

Given the fact that the fluent mapping is generated during runtime you can easily change the string value you provide to the HasColumnType based on the current backend. 

We have implemented a similar solution for a customer by defining an attribute that holds the column types for different backends, that one can place over his properties and a set of extensions methods for the Fluent Mapping API that given a backend would read this attribute and set the column type correctly . If you are interested in this solution we will be more than happy to provide it.

I hope this is helpful.

Kind regards,
Serge
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
0
Roland
Top achievements
Rank 1
answered on 06 Dec 2010, 06:50 PM
Yes, I would be interested in this solution.

PS. What I was expecting is the ORM mapper to know how to map the .NET types to DB types. If string is > 8000 for mssql it should use 'text' type for example not varchar(255). etc.

This is something to think about.
0
Accepted
Serge
Telerik team
answered on 07 Dec 2010, 05:25 PM
Hi Roland,

Please have a look at the project that I have attached. It should give you an idea of how you can accomplish this by customizing the Fluent Mapping trough extension methods. As I have already mentioned this implicit type calculation is not something we are looking forward however you should be able to achieve the same result by yourself. 

If you have any questions or have trouble with the project make sure to let us know. I am looking forward to resolving any issues you might face.

Best wishes,
Serge
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
0
Roland
Top achievements
Rank 1
answered on 07 Dec 2010, 06:22 PM
This is what I need, but would be nice if api supported that automatically when I say: use default mappings.
0
Serge
Telerik team
answered on 09 Dec 2010, 07:40 PM
Hi Roland,

 We will certainly make sure to take this into account when planning the future improvements of the Fluent Mapping API. 

I would like again to thank you for your feedback and mention that while we strive to give you a working solution at the moment we are open to suggestions about the API. 

Best wishes,
Serge
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Tags
Development (API, general questions)
Asked by
Roland
Top achievements
Rank 1
Answers by
Serge
Telerik team
Roland
Top achievements
Rank 1
Share this question
or