zweps79 wrote:
We specifically have chosen to use TypedViews for views so in our application it is clear what actions are possible on the object. Also, the templates LLBLGen uses for creating entities are adjusted. These adjustments are not relevant for views.
IMHO if there is a ID field in the mapping in the Persistence namespace, these should also be an option in LLBLGen to tell which field should be that ID field.
Views don't have ID fields, that's the problem
. The only thing we can do is tell nhibernate some field is the ID field. In case of when you map a typedview on a table, then yes, there's a set of pk fields and we can choose that, but that doesn't help with views. With views, it's not always possible to select a field or group of fields which are the key.
We do have a way to define new settings in the framework setting file for nhibernate so these settings show up for the field in the code gen info tab. But that's a bit cumbersome, e.g. you have to select each field and then check a checkbox. It can however bring you exactly what you want. This would work in situations where there is a compound PK for the view, e.g. you join multiple tables and a group of fields is the unique key.
Another way is to specify distinct with the query you use, this might also help, as nhibernate doesn't do that by default.
Which way would work for you best?
Is it possible to take this in consideration in a future version of LLBLGen, as it is a thread to our application, although it is well documented in our workflow documents?
If something doesn't work in today's version, we fix it.
If it's a small change, e.g.a template adjustment, we'll do it right away. If it's a bigger feature, we'll move it to the next version.