-
Notifications
You must be signed in to change notification settings - Fork 60
Custom datatypes get lost after adding properties via code #242
Comments
I've made a change to translate byte[] to Binary for the model attribute type. Specifying the scale and precision of a decimal isn't supported in the designer yet, but is on the list now that EFCore5 is out. |
Thanks. |
Released in 3.0.1 |
Dear Michael,
First of all, I was hesitating to upgrade to the latest modeler, since I had some minor modifications in my t4 templates, but the upgrade was absolutely smooth and my modifications in fact were not any more needed, since you had them incorporated to the latest version as configuration (one that comes to mind was the selection whether the constructor is protected or public).so, RESPECT and a huge thank you for this great tool!
Now, this is a detective story for you:
Using the 3.4.0.7 version of the designer, I created a new model with the core framework 3.1.14 version selected. Uploaded to git and a partner took it and tried it. Upon code generation he had errors. We checked whether he had the same version of the designer and he did not, he had 3.5.0.2. I thought, what the hell, from github I see latest version 3.4.0, wheredid you find the 3.5.0.2 ? He sai he did the update from inside VS, Extension Manager, Update tab. Does this thing go andtake versions newer than the one you declare as latest?
So, he uninstalled it and installed the 3.4.0.7, re-generated and the errors had gone, but the result was not the same as mine.In the generated DbContext, there were some lines with .Navigation(....)
Checking the templates, I found out that this is only included in the EFCore5ModelGenerator.ttinclude not in the 3 which should be used. Now why was I using the Core3 ttinclude and my partner used the Core5.ttinclude?
What I suspect is the following:
In the model, I had defined the framework version to be 3.1.14. In my computer, dotnet --version gives me 5.0.104
My partner's dotnet --version is 3.1.401.
So could it be that since the 3.1.14 version was not found on his machine, the ef designer chose to use by default core framework 5modeler?
Or am I saying nonsense?
Anyway, I 'll have him update his machine and try again (actually a VS update is needed I suppose).
Hope this helps.
All the best,Alex
|
Hi Alex, Publishing to the marketplace and publishing to Github are separate things, and are manual processes that don't relate to each other. When 3.5.0.2 was published to the Marketplace, I had neglected to publish a release on Github. Normally, Github will have releases that are more recent then the Marketplace, marked as pre-release, but this was human error. The designer doesn't look to see what version of the EF assembly is available; it only looks to see which one is specified in the model properties. So if the model specified a distinct version, it should be using that. To validate that, you can put a breakpoint on any usage of Cheers, |
During importing a model from a compiled assembly (which was created from scaffolding an existing database) I noticed the following:
All tables of the old database I'm trying to import in the designer had a "Timestamp" column of "timestamp" type in the SQL Server, which was scaffolded as Byte[]. It shows, indeed, as Timestamp:Byte[] in the designer. When I open the "Add properties via code" popup to edit a property, I can see the Timestamp:Byte[] in the list. However, when I finish editing and close the popup, the Timestamp property gets deleted from the designer. It looks like the Byte[] is not recognized and is discarded. I suppose that the empty square brackets are not acceptable in the translation, as the translator expects a number in the brackets for the length.
So, I went on to define the property again in the designer, give it a type of Byte (not Byte array) and a Column Type of "timestamp". However, if I open again the Add Properties via Code and make any change to any property, the custom Column Types are lost after saving. Which I discovered is true also for all the decimal properties, for the Column Types of which I had set e.g. "decimal(10, 4)".
The text was updated successfully, but these errors were encountered: