[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?
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.
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.