Add a console application project into your solution and add a reference to your generated C# project.
Add a loop to display the list of your products.
using System;
using OrderProcess.Marketing;
namespace OrderProcess.Application
{
class Program
{
static void Main(string[] args)
{
foreach (Product product in ProductCollection.LoadAll())
{
Console.WriteLine(product.Name);
}
Console.ReadKey();
}
}
}
Then configure the App.config
file. Declare a new configuration section with a section name matching your default namespace and set up your connection string.
<configuration>
<configSections>
<section name="MyDefaultNamespace"
type="CodeFluent.Runtime.CodeFluentConfigurationSectionHandler, CodeFluent.Runtime" />
</configSections>
<MyDefaultNamespace connectionString="database=[MyDatabaseName];server=[ServerName];Trusted_Connection=true" />
</configuration>
Now let's add some data to our model. Select the Product entity and open the Instances Grid windows from the ribbon.
Fill the grid with all the products you need to initialize your database.
Build your model and your database is now filled with your initial data.
Now run the application. It should display our three products.