Entity Framework 6 - first steps to a full xBase solution
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Entity Framework 6 - first steps to a full xBase solution
Robert,
I think I tried various combinations of syntax yesterday - and here I have tried your suggestion - gives the same result so I will now work on the small sample I promised yesterday.
Looks like I need some extra help to get my C# working syntax in-line with Nick's greater experience
Still, if it is working C# then we ought to be able to translate it.
Actually, I got the Lambda syntax from the Reflector translation of Fabrice's plug-in and my C# code.
Maybe we should start to just manually translate the C# I showed earlier.
Cheers,
Phil.
I think I tried various combinations of syntax yesterday - and here I have tried your suggestion - gives the same result so I will now work on the small sample I promised yesterday.
Looks like I need some extra help to get my C# working syntax in-line with Nick's greater experience
Still, if it is working C# then we ought to be able to translate it.
Actually, I got the Lambda syntax from the Reflector translation of Fabrice's plug-in and my C# code.
Maybe we should start to just manually translate the C# I showed earlier.
Cheers,
Phil.
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Entity Framework 6 - first steps to a full xBase solution
Nick,
Thanks for joining in and bringing your greater experience with EF6 and writing configurations.
I got the original C# code for my Configurations working a few years back and have not really re-visited it except for adding sections similar to what is in existence in other classes. Maybe I need a re-think to make the C~ code 'smarter' and in-line with what you do.
Can you send me a full example of one or more of your configuration classes, and include those which show a wide variety of what was Attributes ?
If you rather work personally and direct, then do so, then I can post what we get working, and which is tidier and smoother on the eye.
Thanks a bundle,
Phil.
P.S. Attached is the most complex of my Cologne 2015 examples.
Thanks for joining in and bringing your greater experience with EF6 and writing configurations.
I got the original C# code for my Configurations working a few years back and have not really re-visited it except for adding sections similar to what is in existence in other classes. Maybe I need a re-think to make the C~ code 'smarter' and in-line with what you do.
Can you send me a full example of one or more of your configuration classes, and include those which show a wide variety of what was Attributes ?
If you rather work personally and direct, then do so, then I can post what we get working, and which is tidier and smoother on the eye.
Thanks a bundle,
Phil.
P.S. Attached is the most complex of my Cologne 2015 examples.
Entity Framework 6 - first steps to a full xBase solution
Phil,
AFAIK the expression syntax works. Look at the example below:
Robert
AFAIK the expression syntax works. Look at the example below:
Code: Select all
USING System.Linq.Expressions
FUNCTION Start AS VOID
VAR oExp := (Expression<@@Func<STRING,STRING>>) {|c|c:ToUpper()}
? oExp
VAR oDel := oExp:Compile()
? oDel
? oDel("phil")
RETURN
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Entity Framework 6 - first steps to a full xBase solution
Robert,
I have dropped the '.Lambda' and tried what you sent me.
Since I still have the attached image error, I think it best if I continue to work with Nick to get me a clear and clean (and suitable) C# working version on which to then work to convert to X#.
He may shine a light where I am fumbling in the dark !
Thanks for helping, I will be in touch later.
Cheers,
Phil.
I have dropped the '.Lambda' and tried what you sent me.
Since I still have the attached image error, I think it best if I continue to work with Nick to get me a clear and clean (and suitable) C# working version on which to then work to convert to X#.
He may shine a light where I am fumbling in the dark !
Thanks for helping, I will be in touch later.
Cheers,
Phil.
Entity Framework 6 - first steps to a full xBase solution
Phil,
Did you try:
The expression:
IS a lambda expression
This should be equivalent to the C# code
Robert
Did you try:
Code: Select all
super:@@Property({|e|e:ProductCode}):IsRequired()
Code: Select all
{|e|e:ProductCode}
This should be equivalent to the C# code
Code: Select all
base.Property( e=>e.ProductCode).IsRequired()
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Entity Framework 6 - first steps to a full xBase solution
Okay Robert,
Done that and we seem now to get compilation OK - no DB yet however.
Attached are two ways of coding / syntax - one using 'Super' and one using 'Self', they both compile.
I found some C# stuff this morning that used 'This' and not 'Base'.
What would you recommend I use for X# ?
Am still working with Nick to improve my original code - BUT - I am not as yet creating a database in SQL. No errors as such.
But we can worry about that a bit later ;-0)
Speak soon,
Phil.
P.S. keep sending any ideas that come to your mind.
Oh! and the yellow light bulb in VS2015 has helped me clean my original C# code, and it still works as in Cologne. See images.
Done that and we seem now to get compilation OK - no DB yet however.
Attached are two ways of coding / syntax - one using 'Super' and one using 'Self', they both compile.
I found some C# stuff this morning that used 'This' and not 'Base'.
What would you recommend I use for X# ?
Am still working with Nick to improve my original code - BUT - I am not as yet creating a database in SQL. No errors as such.
But we can worry about that a bit later ;-0)
Speak soon,
Phil.
P.S. keep sending any ideas that come to your mind.
Oh! and the yellow light bulb in VS2015 has helped me clean my original C# code, and it still works as in Cologne. See images.
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Entity Framework 6 - first steps to a full xBase solution
Whoops !
Here is the 'super' to go with the earlier 'self' :-
Phil.
Here is the 'super' to go with the earlier 'self' :-
Phil.
Entity Framework 6 - first steps to a full xBase solution
Phil,
I am glad this is resolved now, and also without the ugly casts etc and by using the simple codeblock style Lambda Expression.
W.r.t. the difference between base and this (SUPER and SELF):
I do not think there is much difference here, unless you are going to overwrite the ToTable() or Property() method in your code. It is a matter of personal preference:
You could argue for base/SUPER, beause this documents that the method is implemented in the parent class
You could also argue for this/SELF, because that would ensure that an overwrite of these methods will automatically be called on places where you use it.
In the end it is just personal preference I think.
Robert
I am glad this is resolved now, and also without the ugly casts etc and by using the simple codeblock style Lambda Expression.
W.r.t. the difference between base and this (SUPER and SELF):
I do not think there is much difference here, unless you are going to overwrite the ToTable() or Property() method in your code. It is a matter of personal preference:
You could argue for base/SUPER, beause this documents that the method is implemented in the parent class
You could also argue for this/SELF, because that would ensure that an overwrite of these methods will automatically be called on places where you use it.
In the end it is just personal preference I think.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Entity Framework 6 - first steps to a full xBase solution
Hi Robert - THANKS,
You and Nick have got me SUCCESS - first DB created from a total X# EF6 applet.
Okay I did a bit of slog work myself, but you and Nick provided the extra knowledge and a good dollop of inspiration as well.
Good team work I think.
Now that I have a runner - albeit rather simple, I can flesh this out to be a few proper entities - and just a bit more fun and games as well ;-0)
I attach a couple of success type images for information to our X# colleagues :-
Best regards to one and all - AND - I have earned myself a nice piece of Julie's cake ;-0)
Phil.
You and Nick have got me SUCCESS - first DB created from a total X# EF6 applet.
Okay I did a bit of slog work myself, but you and Nick provided the extra knowledge and a good dollop of inspiration as well.
Good team work I think.
Now that I have a runner - albeit rather simple, I can flesh this out to be a few proper entities - and just a bit more fun and games as well ;-0)
I attach a couple of success type images for information to our X# colleagues :-
Best regards to one and all - AND - I have earned myself a nice piece of Julie's cake ;-0)
Phil.
- Phil Hepburn
- Posts: 743
- Joined: Sun Sep 11, 2016 2:16 pm
Entity Framework 6 - first steps to a full xBase solution
Okay you guys, we are on our way ..........
Now we have some simple 'seeding' and data 'Population'.
Checkout these easy images for adding Product data rows to the new Table.
The database engine provides the values for the ID's.
Out of interest I have not apparently 'forced' the primary key, it has been done by the compiler and DB engine with what limited code I provided.
Some stuff seems to be being done for us by the EF framework and related 'behind the scenes'.
Hope this X# success interests a few of you guys. And note that the earlier code and syntax 'struggles' have come down eventually to some really very simple code - which works ;-0)
Cheers,
Phil.
Now we have some simple 'seeding' and data 'Population'.
Checkout these easy images for adding Product data rows to the new Table.
The database engine provides the values for the ID's.
Out of interest I have not apparently 'forced' the primary key, it has been done by the compiler and DB engine with what limited code I provided.
Some stuff seems to be being done for us by the EF framework and related 'behind the scenes'.
Hope this X# success interests a few of you guys. And note that the earlier code and syntax 'struggles' have come down eventually to some really very simple code - which works ;-0)
Cheers,
Phil.