Closed frankiDotNet closed 7 years ago
Hi, composite keys aren't something I'm planning to add support for, they are overly complicated and introduce the possibility of major data loss if only part of the key is supplied
Thats sad. Is it possible to help with the work? I have tested many micro orms and yours is realy fast and easy to use. I would love to see your project growing.
Can you change your database so that it doesn't require a composite key? They aren't generally considered to be a good idea these days... You'll also struggle to do much with something like MVC or WebApi if you don't have a single identifier for a record.
Take something in MicroLite such as fetch by Identifier, how would you even represent that with a composite & know which value was which?
Using the current method you have:
var customer = await session.SingleAsync(12345);
Even if your composite key was made of 2 integer values and you had this:
var customer = await session.SingleAsync(12345, 87654);
You'd have to know which order they need to be supplied in to relate to whichever column you need in the database & if you had the following table:
ID1 | ID2 | Name 12345 | 87654 | Fred 87654 | 12345 | Joe
You could easily get the wrong record just by supplying the parameters in the wrong order...
Sure, you are right , and based on a new database I would never create a table without single identifier. Unfortunately most of my projects outside are grown historically without single ids and are realy big. But you are right, that's not a future way to do and could complicate your project. I will try to find a way to code some kind of custom implementation of your Interfaces. If this will fail due to the fact of performance, I would have to switch to PetaPoco I think that's the closest to your project. Thanks for your time, I will continue watching your project and try to use it in new ones.
Please add support for composite keys!!!