Entity Framework Database First

This forum is meant for questions and discussions about the X# language and tools
Post Reply
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

Entity Framework Database First

Post by boonnam »

I am using VS 2017 with XSharp Beta 11.

I am trying to convert my C# test project to X#. I read posts by Phil Hepburn on his EF projects. I was also able to download his solutions. They will come in handy. Thank you, very much Mr. Hepburn. It seem his projects are on Entity Framework code first. My team already have our SQL Server database.

My question is how would I create the EDMX in XSharp? Under C# the wizard starts with "ADO.Net Entity Data Model". I can't find that feature under X#. If anyone have done it, I would appreciate the steps to create the EDMX. Thank you.
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

Entity Framework Database First

Post by Phil Hepburn »

Hi 'S' (this is all I have of your first name),

Anything which can be done in C# can be done in X# - we just need to change the syntax to suit.

When using LINQ to SQl (L2S) in a couple of my samples I did have a database first. I just preferred to code my own classes so that I could get data binding with WPF to work properly.

Look out for the C# samples for EDMX and after making sure you add the correct assemblies into your X# references section, add the required namespaces at the head of your code PRG files.

If you need some help with syntax changes from C# just ask here in the Forum and some knowledgeable guy will answer you, and give help.

Good Luck,
Phil.
Wales, UK.
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Entity Framework Database First

Post by robert »

I am afraid that the 'Ado.NET Entity Data Model' item type is not supported yet by our Visual Studio Project System.
We will try to add this for the General Release from next month, but no promises.

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 Database First

Post by Phil Hepburn »

Thanks for the heads-up Robert !

Yes, the only time I did this in the past was in C# I seem to recall.

Well, if us guys are in a rush to make progress we could always use a C# project in our solution and make the Classes required - then have these in a C# class library which we then access from our X# business oriented code.

The above should work well enough - BUT - if you intend to make regular or frequent changes to the created classes then waiting for a way to create our own X# classes may be a better approach. SO we don't then have bits of C# code "here there and everywhere".

In Vulcan when I used EF6 and LINQ for Cologne samples in the past, I used to make a 'thin' DAL (data access layer) which was a C# class library. It worked okay but was a little restricting for making changes. But at least allowed me to write the rest in xBase syntax.

If I were you, and it is possible for you to do so, I would wait for Robert's promised update features - sometime in the future.

When the new feature is available I intend to add some sections to a 'ClickStart' eVolume so that we have some code and syntax to follow, for future samples and apps.

Best regards for now,
Phil.
Wales, UK.
Post Reply