Case-sensitive columns

5 posts, 1 answers
  1. Ashley
    Ashley avatar
    30 posts
    Member since:
    Nov 2012

    Posted 04 Jan 2013 Link to this post

    Hi,

    We have a scenario where we have a composite primary key with 3 columns. In certain instances the only difference between the records will be the use of a different case.

    Is there a way to set a column as case-sensitive when you map it? I'm imagining something like:
    configuration.HasProperty(table => table.Column).HasLength(50).IsCaseSensitive().IsIdentity();


    Regards,
    Ashley
  2. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 09 Jan 2013 Link to this post

    Hi Ashley,

     By default OpenAccess does no alter your provided column names. This said if you specify them as case sensitive they will stay that way during forward mapping. You can use something similar to this:

    productConfiguration.MapType(x => new
                {
                    ID = x.ID,
                    productName = x.Price,
                    ProductName = x.ProductName
                }).ToTable("Products");
    And it will result in the following schema being created:
    CREATE TABLE [Products] (
        [Products_id] int NOT NULL,             -- <internal-pk>
        [ID] int NOT NULL,                      -- iD
        [productName] numeric(20,10) NOT NULL-- <Price>k__BackingField
        [ProductName] varchar(255) NULL,        -- <ProductName>k__BackingField
        CONSTRAINT [pk_Products] PRIMARY KEY ([Products_id])

    Regards,
    Petar
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
  3. DevCraft banner
  4. Ashley
    Ashley avatar
    30 posts
    Member since:
    Nov 2012

    Posted 09 Jan 2013 Link to this post

    Hi Petar,

    I am talking about the column data. So in a primary key column we could for example have both a and A as 2 separate keys. Is this possible?

    Regards,
    Ashley
  5. Answer
    PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 14 Jan 2013 Link to this post

    Hello Ashley,

     I am afraid that this is not possible at the moment. Currently all pk columns are treated as case insensitive and this cannot be switched off. I will write this down as a feature request and we will discuss the possibility of adding this in the future.
    I am sorry for any inconvenience caused. Please find your Telerik points updated for bringing this issue to our attention.

    Greetings,
    Petar
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
  6. Ashley
    Ashley avatar
    30 posts
    Member since:
    Nov 2012

    Posted 21 Jan 2013 Link to this post

    Hi Petar,

    Thanks for the feedback.

    Regards,
    Ashley
Back to Top
DevCraft banner