Page 1 of 1

Query Types

Posted: Sat 26 Oct 2019 20:21
by SSSikora
Hello,

I have a couple of classes in my model that have QueryType set to true. I just set the output of my classes to EF Core 3.0 from 2.0 and now when I run my application I get a message saying that the class in question requires a primary key and if I intended it to be a keyless entity that I should have called HasNoKey(). Is this a bug in the Entity Developer generated output? I do not see anywhere else in the designer to mark the class as not requiring a key. Any help appreciated.

-Scott

Re: Query Types

Posted: Mon 28 Oct 2019 15:19
by Shalex
Please set EF Core version=EF Core 3 in Model Settings and regenerated the code.

Re: Query Types

Posted: Tue 29 Oct 2019 15:45
by SSSikora
Thanks for the reply, but what I'm saying it that's what I've already done - set the output type to 3 and it is not generating the proper code and I am receiving the error I mentioned in my post. I am using build 6.6.852.

-Scott

Re: Query Types

Posted: Wed 30 Oct 2019 20:53
by Shalex
With EF Core version=EF Core 3 (Model Settings) and QueryType=True (class properties), Entity Developer generates modelBuilder.Entity<...>().HasNoKey(). Runtime works in our test. Refer to https://docs.microsoft.com/en-us/ef/cor ... changes#qt.

If this doesn't help, send us a small complete test project for reproducing the issue.

Re: Query Types

Posted: Wed 30 Oct 2019 21:20
by SSSikora
I just used the link you provided to send you a copy of my model.

Thanks,
Scott

Re: Query Types

Posted: Wed 06 Nov 2019 12:08
by Shalex
We have reproduced the issue. It persists when Self-Contained Entity Configuration is set to True in the EF Core template properties.

As a temporary workaround, please set Self-Contained Entity Configuration=False.

Re: Query Types

Posted: Wed 06 Nov 2019 13:10
by SSSikora
I'm glad you found the issue but disabling the entities configuration file does not work for me, I need to keep my model classes clean. Please advise as to when this issue will be corrected.

Thanks,
Scott

Re: Query Types

Posted: Sat 09 Nov 2019 18:58
by Shalex
The bug with generating .HasNoKey(), when Self-Contained Entity Configuration is set to True in properties of EF Core template, in EF Core 3 model is fixed.

We have sent the internal build with the fix to your email.

Re: Query Types

Posted: Mon 11 Nov 2019 21:50
by SSSikora
That did indeed fix my problem, thank you so much!

Regards,
Scott

Re: Query Types

Posted: Thu 21 Nov 2019 18:57
by Shalex
New build of Entity Developer 6.6.872 is available for download now: viewtopic.php?f=32&t=39567.