Entity Framework 6 - first steps to a full xBase solution

Public forum to share code snippets, screen shorts, experiences, etc.
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Entity Framework 6 - first steps to a full xBase solution

Post by Phil Hepburn »

Hi Robert, Team, and guys,

Well, I now have my head back into 'Entity Framework 6' (as version 7 seems a long way off, and will most likely be 'Entity Core' instead, according to wen articles etc..

Still 'EF6' is working well in C#, and is set to be around for quite some time according to reliable sources.

So I am first trying to convert my old Vulcan / C# 'hybrid' Cologne apps into fully coded X# ones. In the past I used a 'thin' DAL (data access layer) where the LINQ stuff was done in C# and the other stuff in Vulcan. Nice WPF data bound example.

I have some of code compiling with the X# compiler, but now I am having some problems with the 'Configuration' classes, when I try and code them in X# from CSharp. And Fabrice's Reflector plug-in gives me an amazing complex and large translation ;-0( It may be correct BUT will put guys off EF for life I would guess ;-0)

Can you just look at the first three attached small images to see if you can see what I can do (easily) to put things right ?

Here is the CSharp code :-
EF_XS_02.jpg
EF_XS_02.jpg (42.86 KiB) Viewed 651 times
And now you can see what I was trying :-
EF_XS_01.jpg
EF_XS_01.jpg (60.54 KiB) Viewed 651 times
Here below (included) is an image of my best try as well as the errors :-
EF_XS_04.jpg
EF_XS_04.jpg (94.33 KiB) Viewed 651 times
And for any who wish to see the Reflector details ;-0))) see below (if you can read the detail !?
EF_XS_03.jpg
EF_XS_03.jpg (27.76 KiB) Viewed 651 times
HELP most welcomed.

Regards,
Phil.
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Entity Framework 6 - first steps to a full xBase solution

Post by wriedmann »

Hi Phil,

maybe a first help: "func" is a reserved word in X#.

The following code fails to compile:

Code: Select all

class Func
end class
where as

Code: Select all

class @@Func
end class
compiles.

Maybe you could try to write <func> as <@@func>

Wolfgang

P.S. this code compiles on my machine:

Code: Select all

using System.Collections.Generic

class @@func
end class

class TestFunc    
	protect oFuncs		as List<@@Func>
end class
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Entity Framework 6 - first steps to a full xBase solution

Post by Phil Hepburn »

Thanks Wolfgang,

Great!

That has gotten me further it would seem - so now I have the following single issue being reported.

Any ideas - you or anyone else ?

Thanks in advance ;-0)
Phil.
EF_XS_11.jpg
EF_XS_11.jpg (94.33 KiB) Viewed 651 times
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Entity Framework 6 - first steps to a full xBase solution

Post by Phil Hepburn »

Sorry,

Wrong image - must be watching the football has made my concentration go ;-0)

Try two
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Entity Framework 6 - first steps to a full xBase solution

Post by Phil Hepburn »

Try three ?
EF_XS_04.jpg
EF_XS_04.jpg (38.8 KiB) Viewed 651 times
This should be a single error line reported .............>>

Cheers,
Phil.
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Entity Framework 6 - first steps to a full xBase solution

Post by wriedmann »

Hi Phil,

this try was the right one <g>. But I have let this to someone other, maybe Chris or Robert.

Wolfgang

P.S. have to go back to VO programming now
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Entity Framework 6 - first steps to a full xBase solution

Post by robert »

Phil
Can you create a small (10 line) sample without external depedencies that reproduces this ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Entity Framework 6 - first steps to a full xBase solution

Post by Phil Hepburn »

Hi Robert,

Yes, I think I can do that tomorrow - too late tonight, and I have spent enough brain power on EF6 for today ;-0)

Although I can make a small example - without outside dependencies - just 10 lines may be pushing things a bit.

Fingers crossed I can send you something useful. I have got quite a way with this in order to get EF6 working, this just feels like the last step (or two) - then we will 'have it'.

Do you wish me to send the code etc., to your private mail box ? It would seem like the best thing to do. I can then post stuff when we get a working syntax, and the code nice and tidy.

All the best,
Phil.
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Entity Framework 6 - first steps to a full xBase solution

Post by robert »

Phil,

If I look at your example (on a larger screen then yesterday) I see:

System:Linq:Expressions:Expression:Lambda<.....>

Shouldn't that be:

System.Linq.Expressions.Expression.Lambda<.....>

Not sure if this solves your problem, but I think these are all namespace delimiters and should be dots in stead of colons.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
NickFriend
Posts: 248
Joined: Fri Oct 14, 2016 7:09 am

Entity Framework 6 - first steps to a full xBase solution

Post by NickFriend »

Hi Phil,

I may be missing something, but I don't understand your original C#. Why not just use something like

Code: Select all

HasOptional(e => e.Attendee).WithMany().HasForeignKey(x => x.AttendeeID)
That ought to translate to X#.
Or just use Nullable<>.

Nick
Post Reply