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

Default Field Mapping for Boolean data type.

2 Answers 171 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.
Joshua
Top achievements
Rank 1
Joshua asked on 09 Jan 2013, 05:47 PM
Hello, I am somewhat new to using OpenAccess ORM but I have already a database of 20+ tables with many columns and interdependencies. So far so good except that I am finding that the default binding for the "Boolean" datatype automatically defaults to "TinyINT" when using MSSQL and using the "Database from Domain Model" migration tool.

I can manually switch the mapped data types to "bit" but it seems to automatically revert back to the default setting of "tinyint".

Is this a bug? I don't think TinyINT is the appropriate data type to map to boolean values, I thought bit was... Am I wrong?


Thanks for your help, community.

2 Answers, 1 is accepted

Sort by
0
Boris Georgiev
Telerik team
answered on 10 Jan 2013, 02:38 PM
Hello Joshua,

By design the default mapping from .NET Boolean type is TinyINT in MS SQL Server types.
 
OpenAccess ORM provides a great feature that allow you to change multiple elements in a model easily with a single operation - the Batch Operations Dialog. In this case, you can change the MS SQL types for all the existing properties you select on the dialog to bit. After you map all the tables you need:
1) In Batch Operations dialog, in Display Mode select "Members".
2) From "Property" select CLR type = "Boolean" and select all properties.
3) From "Operations" select "Change SQL Type"
4) From "Set SQL type to" select "bit" and execute operation.

For your convenience I also attached a screenshot. You can also find a demonstration of the Batch Operations dialog on Telerik TV.

I hope that helps. If any other questions arise, do not hesitate to contact us.

Regards,
Boris Georgiev
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
0
Joshua
Top achievements
Rank 1
answered on 10 Jan 2013, 04:20 PM
Thank you for your extremely quick response and detailed answer. This makes total sense now!
Tags
Getting Started
Asked by
Joshua
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Joshua
Top achievements
Rank 1
Share this question
or