Default Field Mapping for Boolean data type.

3 posts, 0 answers
  1. Joshua
    Joshua avatar
    2 posts
    Member since:
    Jul 2012

    Posted 09 Jan 2013 Link to this post

    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. Boris Georgiev
    Admin
    Boris Georgiev avatar
    190 posts

    Posted 10 Jan 2013 Link to this post

    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.
  3. DevCraft banner
  4. Joshua
    Joshua avatar
    2 posts
    Member since:
    Jul 2012

    Posted 10 Jan 2013 Link to this post

    Thank you for your extremely quick response and detailed answer. This makes total sense now!
Back to Top