Commit 4b8c760b authored by Andres Käver's avatar Andres Käver
Browse files

console demo

parent a9b0f1f9
......@@ -12,6 +12,8 @@ ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{B1A6987F-378A-4FFE-8DF7-BB58C81FFC48}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -30,5 +32,9 @@ Global
{E187E8A0-09A8-4ABF-A50F-95812AE5CC9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E187E8A0-09A8-4ABF-A50F-95812AE5CC9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E187E8A0-09A8-4ABF-A50F-95812AE5CC9E}.Release|Any CPU.Build.0 = Release|Any CPU
{B1A6987F-378A-4FFE-8DF7-BB58C81FFC48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1A6987F-378A-4FFE-8DF7-BB58C81FFC48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1A6987F-378A-4FFE-8DF7-BB58C81FFC48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1A6987F-378A-4FFE-8DF7-BB58C81FFC48}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DAL\DAL.csproj" />
</ItemGroup>
</Project>
using System;
using DAL;
using Microsoft.EntityFrameworkCore;
namespace ConsoleApp
{
class Program
{
private static readonly DbContextOptionsBuilder<AppDbContext> _dbOptions =
new DbContextOptionsBuilder<AppDbContext>()
.UseMySQL("server=alpha.akaver.com;database=student2018_andreskaver_book2;user=student2018;password=student2018");
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
using (var ctx = new AppDbContext(_dbOptions.Options))
{
foreach (var book in ctx.Books)
{
Console.WriteLine(book.BookTitle);
}
}
}
}
}
\ No newline at end of file
......@@ -18,5 +18,8 @@ namespace DAL
{
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment