fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: I did it!! Entity Framework 6 with X#...

I did it!! Entity Framework 6 with X#... 4 months 1 week ago #7663

  FoxProMatt_MattSlay's Avatar Topic Author FoxProMatt_MattSlay Offline Posts: 149
In a previous thread I said that I already had a working Entity Framework 6 data access project in C# that I had written a year or more ago as I was studying Entity Framework against Sql Server to access data that is presently used by my Visual FoxPro application.

So tonight I sat down and created a new X# Winforms application in Visual Studio 2017, and was determined I would see if I could get X# to use the DLL from my existing C#/EF Data project, and if I could write some little bit of X# Core code to use the existing classes in that project to get data from my Sql Server and show it on a form. I have only learned a little about this platform so far (remember I am a VFP guy and C#), but it's not all that different, right? And, Johan has been enlightening me a little, and I have spent about 2-3 hours so far reviewing code samples and forums posts.

It only took about 30 minutes to get the darn thing working. As a C#/.Net/Visual Studio experienced user, it was pretty easy. Had to add some DLL references and/or Nuget packages, but that was to be expected (I mean, this is .Net after all).

In code, I created a Business Object instanced from one of my data access object class, then I call a method on that BO which returns an IEnumable list of Customers, then I iterate over that with X# Foreach, and I wrote some text to a form control from the records in the data set. You can see the result and my code in the attached image. (Remember I am an X# newby, so if my code is poor, please let me know).



It's basically the same exact thing I have done in C# before. I mean, it's almost *exactly* the same exact code, except for using := and the way you declare your strongly typed variables.
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by FoxProMatt_MattSlay.

I did it!! Entity Framework 6 with X#... 4 months 1 week ago #7664

  wriedmann's Avatar wriedmann Offline Posts: 1631
Hi Matt,
congratulations!
The great thing about X# is that you can combine new tecnology like the Entity Framework with your VFP code and syntax.
I have a bit of experience with X# Core, but when it comes to development speed, I'm much faster when I can use Xbase features like arrays and codeblocks together with all the functions from the runtime.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

I did it!! Entity Framework 6 with X#... 4 months 1 week ago #7666

  lumberjack's Avatar lumberjack Offline Posts: 491
Matt,

Well done Sir! You amaze me more and more. We need more of your type on the X# team/community/family. We will conquer the XBase world.

Thanks also for the WhatsApp calls (hands free if somebody is worried) while you drive to work, it starts to feel as if we knowing each other already for years... Well, we both speak the XBase lingo, so what is there more to expect?

This is a great example. Maybe you need to, as you mentioned send us a link or two of what you have on YouTube based on your VFP work. The new Channel X# is going to happen: Ladies and gentlemen you tuned in to Channel X#, today we will be talking about, well you guess Xbase and .NET... :P
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

  • Page:
  • 1