CompositeKeyAttribute does not create any composite key on the table

As title, I’ve created a table as:

[Alias("LRTFILTRISQLIN")]
[CompositeKey(nameof(FilterUniquifier), nameof(IdToFilter))]
public class LRTFiltriSqlIn
{
    [Ignore]
    public string Id => "{FilterUniquifier}|{IdToFilter}"; // i've removed the dollar simbol does to a glitch?

    public long FilterUniquifier { get; set; }

    public int IdToFilter { get; set; }
}

I can see that on SQL Server, no key or index gets created at all. How can I create a Composite Unique Clustered Index from that table and OrmLite?

You can’t use [CompositeIndex] to create a composite index in OrmLite.

I don’t know why you’re using [CompositeKey] it’s not used or documented anywhere in OrmLite, it’s only used by PocoDynamo.

My PrimaryKey is actually those 2 fields. CompositeIndex can help me but things like SaveAll() crashes without a PrimaryKey. I tought CompositeKey was a way to define a PrimaryKey with 2 fields.

I don’t know why you would think that, there’s no docs or example of it ever having been used in OrmLite.

Unless it’s been documented somewhere, or used in a test case, it doesn’t exist, in which case you can raise a feature request but don’t open a support request asking why something that has never existed doesn’t work.

A fundamental limitation that has always existed in OrmLite is that it only supports a single primary key.

I realize this is three years old, but the fact that a CompositeKey exists in ServiceStack.DataAnnotations would indicate that there is such a thing, a composite key that can be created with 1 or more columns.

I understand that this does not work and should not be used in OrmLite as per above answers, but I think that the CompositeKeyAttribute should either be inaccessible or have some Obsolete warning on it, or something else, to explain that we cannot use it as expected.

I will definately add this as a feature request =)

It’s existence in DataAnnotations does not imply where an attribute can be used, if it’s not a documented library feature, then it should be inferred as it’s not supported by that library. Please do not raise a feature request for OrmLite, its primary Single Primary Key limitation is by design and wont change.

[CompositeKey] is for defining Hash and Range Keys for DynamoDB in PocoDynamo.

I already did, as per your recommendation in a previous answer:

Unless it’s been documented somewhere, or used in a test case, it doesn’t exist, in which case you can raise a feature request

That is why I did it =)

This does not include by design limitations that’s already been addressed, which just wastes everyones time.

Well, it sounded to me like you asked to have that feature request on UserVoice.