Allow customization of ModelDefinition in ORM Lite
I need to be able to customize the ModelDefinition after it is generated by ORM Lite. I propose adding a method to IOrmLiteDialectProvider named CustomizeModelDefinition(ModelDefinition modelDef). In the base dialect providers, there are multiple methods used to create ModelDefinitions. I propose that all of those calls be routed through one method in OrmLiteConfig.GetModelMetadata(this Type modelType). In that method, after the model is created, it would invoke DialectProvider.CustomizeModelDefinition(modelDef). I downloaded and implemented this and tested it. It didn't take long and worked well. I would be happy to share the code.

-
Igor Gatis commented
I managed to make this work for protobuf-csharp-classes. The answer is here: http://stackoverflow.com/questions/31420049/is-there-way-to-use-protobuf-csharp-port-generated-classes-with-servicestack-orm/31710296#31710296
-
Igor Gatis commented
Answering admin's comment:
I forgot to mention protobuf-csharp-port generted classes have no null properties. Instead of comparing the property to null, one must check .HasPropertyX.
-
Igor Gatis commented
I'd like to use OrmLite with protobuf-csharp-port generated classes.
Each entity has two generated classes:
1. "Foo" which is immutable (like String)
2. "Foo.Builder" which is mutable and produces a "Foo" when .Build() is called (like StringBuilder and .ToString()).I cannot use Foo because it has no setters. Although I can work around Foo.Builder's name with [Alias("Foo")], it has a bunch of properties which must not become columns. The list is bigger but I think these gives the picture.
-
Why aren't you able to customize the model directly yourself on startup? i.e with:
var modelDef = typeof(Poco).GetModelMetadata();
modelDef..