I can’t help but feel I am missing something but to this day I cannot find the answer.
I am doing a model-first entity framework and have a few properties set as DateTime. These translate to DateTime in the database – but I would like to use SmallDateTime. In my case, getting down to seconds and milliseconds just isn’t worth the double storage for as many rows as I will have.
Does anyone know a way in the model-first environment to map DateTime to a SmallDateTime DB field? As a last hope, I can generate the DDL, replace all, and update the Model from the database after – but I feel that is obnoxious!
Thanks in advance.
It’s a kind of tricky thing.
First of all read this article Model first if you have not yet.
Then create separate class library project with custom
IGenerateActivityOutputimplementation.The next step is to modify database generation workflow.
OutputGeneratorTypeofCsdlToSsdlAndMslActivityto"MyCSDLToSSDL.MyCsdlToSsdl, MyCSDLToSSDL". Double quotes are required.Looks very much like a workaround but it works. 🙂 Hope it helps!