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#... 12 Mar 2019 04:19 #7663

  • FoxProMatt's Avatar

  • FoxProMatt

  • Topic Author

  • Posts: 377
  • 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.

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

    Last edit: by FoxProMatt.

    I did it!! Entity Framework 6 with X#... 12 Mar 2019 07:43 #7664

  • wriedmann's Avatar

  • wriedmann

  • Posts: 2232
  • Hi Matt,
    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 Riedmann
    Meran, South Tyrol, Italy

    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#... 12 Mar 2019 11:11 #7666

  • lumberjack's Avatar

  • lumberjack

  • Posts: 680
  • 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