Creating a new Entity Data Model using VS 2013 to work with Entity Framework vi.1.three

If you utilize your U2 accounts to access SQL-based applications, then this blog is written for yous. Here I'll hash out Entity Framework, Visual Studio and provide some screen shots and sample lawmaking.

Entity Framework four.0 or 5.0 is function of old Visual Studio (VS) versions. When upgrading to VS 2013 or later versions, it creates a .NET Framework 4.5 awarding to work with the newer Entity Framework 6.ane.ten version. It requires the Manage NuGet Packages tool to install it and it also requires an boosted registering process to recognize the Rocket U2 Toolkit driver.

Before you can brainstorm using your U2 accounts in SQL-based applications, you must make the U2 data accessible to those applications. Information technology requires Visual Schema Generator (VSG) to create new sub-table or view schema on UniData accounts. On UniVerse, it needs to run the HS.ADMIN tool to actuate a UniVerse account for dynamic normalization or to create a new schema on the account. The HS.SALES and HS.SERVICE accounts take been activated during UniVerse installation by default.

Requirements

U2 Toolkit for .Internet Developer 2.2.2
U2 Toolkit Developer license
UniVerse 11.one or UniData vii.iii or later
Visual Studio 2013, 2015, or 2017
Microsoft.NET Framework four.five or later
ADO.Net Entity Framework 6.i.x
Preparing U2 accounts using UniData VSG or UniVerse HS.ADMIN tool

Installing U2 Toolkit for .Net Developer and Licensing

The Rocket U2 Toolkit for .Cyberspace Developer software cannot exist found on the Rocket Production availability web site. You lot must gild the product with the U2 Toolkit Programmer license via RBC or your value-added-reseller (VAR).  When you lot install Rocket U2 Toolkit for .Cyberspace Developer software, information technology also installs 32-bit and 64-bit Rocket U2 Toolkit for .Cyberspace Provider software.

The software installation and licensing information tin be institute in the U2 Toolkit manual. The installation setup menu expect like the following:

The U2 Toolkit for .Internet Programmer'due south Authorization tool can be institute in the Rocket U2 sub folder. You must accept a U2 Toolkit programmer serial number for authorization from the RBC team. The authorization code tin be generated on the Rocket Business concern Connect web site – https://rbc.rocketsoftware.com/

The U2 Toolkit for .Internet Developer's Authorization tool is run as the following output.

Procedure

When y'all use Visual Studio 2013 to create a new C# application, it will use a target .NET Framework four.5. On newer VS 2015 and VS 2017, it generates a .Net Framework four.half-dozen application by default that needs a dissimilar U2 Toolkit 4.6 driver to piece of work with.  This blog provides unproblematic steps to create a C# console program on a VS 2013 surround.

1. Open a project in Visual Studio. This projection was created in Visual Studio 2013.
two. Select the programming language y'all desire to work in. The examples in this certificate are all created using C#.
3. Select File > New Projection.
iv. When the New Project dialog box opens, select Windows / Console Application.
5. In the name field, enter a name for the project. The project proper name in this example is ConsoleApplication1.
half-dozen. In the location field, enter the location where the project volition reside. The location in this case is C:\temp.
7. Click OK. It will create a .NET Framework 4.five application past default.

  1. Starting with Entity Framework 6.1.3, this version volition ship independently from Microsoft Visual Studio software. In Visual Studio 2013, you must have the Manage NuGet Packages tool from the TOOLS carte du jour of the VS C# project or you tin't select the Entity Framework half-dozen.one.3 bundle (using the Manage Nuget Packages). New Entity Framework information will be added to the App.config file.

nine. Add a new Course object to the project and put the "Client.cs" in the Name field and update Customer.cs file with the sample code.

Note: You lot must add together the CustomerContext connection string with U2 server credential information in the app.config configuration file.

  1. Update the App.config file for the CutomerContext connection string to find the Customer entity. In the connection string, it needs to specify the provider name equally "U2.Data.Client.4.5"; you need to define the entry in the providers list.

Note: For the U2.Data.Client.Entity 4.6 driver, the PublicKeyToken is "7f1dc11a3fe611eb". You can employ the VS 2013 x86 native sn command with "-T" option to observe the public token data.

11. Add the SqlQuery statement to the Customer entity to the Programme.cs file.

Panel application result

The sample program should return the entity query as the following output.