-
Notifications
You must be signed in to change notification settings - Fork 60
Errors while generating entity code from efmodel built using existing codebase #150
Comments
Wow. That's a lot to take in, but let me see what I can do.
The designer is (should be?) completely persistence-agnostic. The code it generates stops at the Entity Framework level, and the persistence mechanism, be it SQL Server, Oracle, SQLite or in-memory, is handled by EF.
A constructor is created when any required properties are modeled, so that the end user can provide those parameters at the beginning of the object's life. There was an issue in one release where the constructor parameters weren't getting calculated correctly, but that's been corrected in 2.0. In the case of the object having required parameters, we still need to generate a default constructor to make Entity Framework happy, but that constructor doesn't have to be (and isn't) public.
I haven't seen that behavior, Can you give me a step by step, with example data?
Enums and classes are different element types, and you can't change one into the other. But dropping an enum onto the model should generate an Enum element - is that what you're asking?
See above - storage type isn't a concern, and the actions you take when modeling aren't aware of the persistence mechanism. I'm not familiar with SQLite, though ... if the EF driver doesn't support associations, that will have to be an enhancement made in that driver.
I'm afraid that's more of a real estate problem ... there isn't a whole lot of space to work with in the void area between the attribute text and the edge of the element box. I had to make the design choice to replace the attribute icon with the warning icon, although I'd really like to show both.
You can already flag that a property should be indexed (although there isn't support for multi-property indices). Exporting data as CSV is a runtime thing rather than a modeling thing, so it's out of scope, and views are too low level for what the modeler does ... EF supports database views (if persistence happens on a database) as a read-only data source, and EFCore has better support for that than EF6, although both can handle it.
Sure. No problem. |
Thanks Michael. I will work on getting you a sample repro on this issue. For now, immediate pain is there are two default constructors created. There is a protected default constructor and a public default constructor. The issue is in the public default constructor which gets called in a static method create that returns a new instance of the class using the public constructor where it is trying to pass required parameter. This is that public instructor which should have parameters which I don't see in the generated code. |
Hi @msawczyn - I am sorry for not providing the repro yet. Things have been just up side down on priorities with given situations around all of us. Will you please keep this issue open. I can't reopen it as I am not an owner on this repo. I would like to verify your fix - if that's ready and provide you with my findings. Thank you |
No problem. Happy to do so. |
Thank you @msawczyn. |
Yes. Give it a few hours.
…On Sat, Apr 11, 2020, 2:01 PM IoTFier ***@***.***> wrote:
Thank you @msawczyn <https://github.com/msawczyn>.
Tried to update the package but the VS marketplace is giving an error -
not found.
*Are you in the process of publishing the update ?*
[image: image]
<https://user-images.githubusercontent.com/26844611/79051190-6e3dc500-7bf4-11ea-9a16-77139c9e33b1.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#150 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANSGCXXF3RHREDJE2XUCM3RMCV6JANCNFSM4KV4XT2A>
.
|
Just curious ... I still don't see the nuget with 2.0 update in the Marketplace. |
Hi @msawczyn , the dragging of my existing POCO on .efmodel / design pane doesn't show up the corresponding class. Thank you |
Thanks for the report. I'll look into it. To clarify, you're dragging a .cs file from the Solution Explorer onto the design surface and it doesn't add the class? Or are you dragging from the Windows File Explorer? Both should work, but there have been a lot of changes to the drag/drop code to support the new multi-diagram feature and something may have slipped through the cracks. |
HI @msawczyn - I removed a portion of my prev comments. I guess that was from a clipboard buffer. My apologies for that. I am dragging .cs file from the solution explorer onto the design surface. As I digged it further, it is creating .cs file (for some of my .cs classess) but not showing the entity added on the design panel. As I had offered this earlier, would you be interested in a screen share session? That may be more worthwhile for our efficiency and productivity of this capability ? Thank you, |
Sorry, but I won't be able to do a screen share. Time is tight right now and I can't guarantee when I'll have time to look into this ... likely tonight, which may be 8 hours from now. The perils of side projects. |
Sounds good. Thank you. |
Fixed in 2.0.1 |
Thank you @michael-sawczyn. |
Hi @msawczyn, good morning ! Another set of errors I when I drop .cs file on efmodel design panel and try to save the diagram (with no entities shown on the panel) are -
|
Essentially, both of the behaviors you're seeing are by design. |
BTW, this chain is getting quite long and convoluted. I'm going to close it now. If you have other bug reports I would love to see them, but they need to be entered each as separate reports so they can be tracked and not get lost. |
Hi @msawczyn , good afternoon ! Happy Saturday !
As mentioned in my #81 - I am trying to incorporate EF Core (v 3.1.1 now) in my Mobile App's Data services layer.
The diagram below shows the overall process I am following in getting a stable state of generating Entities using your EFDesigner tool and getting ready for generating SQLite database via EFCore migrations (which I have been trying to avoid on a parallel attempt to do that only via dbcontext scaffolding route).
Per diagram, after saving the efmodel I am facing number of errors in the generated code. Your help for in addressing my queries around that would be truly appreciated -
Does EFDesigner code generation has influence specifically to support SQL Server target as the database ? Which I am ok when read to take the effort for database behind my APIs but on mobile my target database is SQLite.
A new non-default constructor is created where initialization of the member variable including null check, and any other entity association is done. Apparently this constructor doesn't have any parameters. Is this by design ? The Create method attempts to call this constructor but compilation fails as there are not params in the non-default constructor. The error is "already defines a member called .ctor with the same parameter types.
Referred local variables in the new constructor are missing their definition -
e.g. if (string.IsNullOrEmpty(message)) throw new ArgumentNullException(nameof(message));
this.Message = message;
The "message" is suppose to be a member variable based on the entity property "Message". But, the generated class doesn't have a member variable by name message. I checked across the class files and those were missing,
If I drop an updated class file from the first step (blue color blocks on the left in my diagram) on the left series of step onto efmodel, the generated code has duplicate entry for the collection causing errors.
How to stereotype entities as enum after the existing class is dropped on efmodel diagram?
In the lieu of SQLite - how to use associations to depict 1:1, 1:* and : relationships ?
Can warning such as missing documentation per entity attribute be shown on the left of the existing icons per attribute that way we can see both type of attribute and any missing input via warning sign ?
SQLBrowser utility supports exporting tables as CSV, Create Indexes, Views on SQLite db. Will you consider supporting such feature in the EFDesigner ?
I would appreciate if you would allow me to add additional errors in this github issue as I follow this path as mentioned in the process diagram below.
Will you please not close this issue until I get to fully create a stable entity model (as outlined in the diagram below) ?
The text was updated successfully, but these errors were encountered: