Skip to content
This repository was archived by the owner on May 9, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion EntityFrameworkCore.FirebirdSQL.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.3
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.FirebirdSQL", "EFCore.FirebirdSQL\EFCore.FirebirdSQL.csproj", "{C725AC99-64C8-4CBF-B01F-094D5837BC58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCore.FirebirdSQL.Console.Test", "EFCore.FirebirdSQL.Test\EFCore.FirebirdSQL.Console.Test.csproj", "{E1786F5D-5D2C-4231-BEFA-A563F075BD8B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{48F660F0-8ED4-4688-A565-0E2CEAF15A81}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{61F7E35E-FCDB-499E-B527-85A2D268F227}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCore", "AspNetCore", "{641AAD0D-B815-41BE-A5E6-32C941D7620A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScaffoldingConsoleApp", "ScaffoldingConsoleApp", "{DA2BBCEF-5423-4437-9157-D6A788F5DA2F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScaffoldingConsoleApp", "Samples\ScaffoldingConsoleApp\ScaffoldingConsoleApp.csproj", "{DC5FD402-9857-4917-9B95-EE1E806E8B8B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.Firebird.AspNetSample", "Samples\AspNetCore\EFCore.Firebird.AspNetSample\EFCore.Firebird.AspNetSample.csproj", "{DF2CF326-D401-4394-9A3A-56F244430EEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -23,12 +33,24 @@ Global
{E1786F5D-5D2C-4231-BEFA-A563F075BD8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1786F5D-5D2C-4231-BEFA-A563F075BD8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1786F5D-5D2C-4231-BEFA-A563F075BD8B}.Release|Any CPU.Build.0 = Release|Any CPU
{DC5FD402-9857-4917-9B95-EE1E806E8B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC5FD402-9857-4917-9B95-EE1E806E8B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC5FD402-9857-4917-9B95-EE1E806E8B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC5FD402-9857-4917-9B95-EE1E806E8B8B}.Release|Any CPU.Build.0 = Release|Any CPU
{DF2CF326-D401-4394-9A3A-56F244430EEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF2CF326-D401-4394-9A3A-56F244430EEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF2CF326-D401-4394-9A3A-56F244430EEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF2CF326-D401-4394-9A3A-56F244430EEF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E1786F5D-5D2C-4231-BEFA-A563F075BD8B} = {48F660F0-8ED4-4688-A565-0E2CEAF15A81}
{641AAD0D-B815-41BE-A5E6-32C941D7620A} = {61F7E35E-FCDB-499E-B527-85A2D268F227}
{DA2BBCEF-5423-4437-9157-D6A788F5DA2F} = {61F7E35E-FCDB-499E-B527-85A2D268F227}
{DC5FD402-9857-4917-9B95-EE1E806E8B8B} = {DA2BBCEF-5423-4437-9157-D6A788F5DA2F}
{DF2CF326-D401-4394-9A3A-56F244430EEF} = {641AAD0D-B815-41BE-A5E6-32C941D7620A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CCB461D4-B163-4511-8434-CE0C357FDC74}
Expand Down
25 changes: 25 additions & 0 deletions Samples/AspNetCore/EFCore.Firebird.AspNetSample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCore.Firebird.AspNetSample", "EFCore.Firebird.AspNetSample\EFCore.Firebird.AspNetSample.csproj", "{A0E6AA62-FFB2-415B-A70C-CA99939537D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A0E6AA62-FFB2-415B-A70C-CA99939537D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0E6AA62-FFB2-415B-A70C-CA99939537D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0E6AA62-FFB2-415B-A70C-CA99939537D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0E6AA62-FFB2-415B-A70C-CA99939537D3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5420DE74-243E-4CC7-8937-FA1BEDB2A622}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SouchProd.EFCore.Firebird.AspNetSample.Models;
using Microsoft.EntityFrameworkCore;

namespace SouchProd.EFCore.Firebird.AspNetSample.Controllers
{
[Route("api/[controller]")]
public class Authors2Controller : Controller
{
private SampleModelsContext _dbContext;

/// <summary>
/// Controller constructor
/// </summary>
/// <param name="dbContext">Database context from the Dependency injection</param>
public Authors2Controller(SampleModelsContext dbContext)
{
_dbContext = dbContext;

// Perform the pending migrations automatically
_dbContext.Database.Migrate();
}

// GET api/authors
[HttpGet]
public async Task<IEnumerable<Author>> GetAsync()
{
return await _dbContext.Authors.AsNoTracking().ToListAsync();
}

// GET api/authors/5
[HttpGet("{id}")]
public async Task<Author> Get(int id)
{
return await _dbContext.Authors.FirstOrDefaultAsync(x => x.AuthorId.Equals(id));
}

// POST api/authors
[HttpPost]
public void Post([FromBody]Author value)
{
_dbContext.Authors.Add(value);
_dbContext.SaveChanges();
}

// PUT api/authors/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]Author value)
{
_dbContext.Authors.Update(value);
_dbContext.SaveChanges();
}

// DELETE api/authors/5
[HttpDelete("{id}")]
public void Delete(int id)
{
var entity = _dbContext.Authors.FirstOrDefault(x => x.AuthorId.Equals(id));
if (entity != null)
{
_dbContext.Authors.Remove(entity);
_dbContext.SaveChanges();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SouchProd.EFCore.Firebird.AspNetSample.Models;

namespace EFCore.Firebird.AspNetSample.Controllers
{
[Produces("application/json")]
[Route("api/Authors")]
public class AuthorsController : Controller
{
private readonly SampleModelsContext _context;

public AuthorsController(SampleModelsContext context)
{
_context = context;
}

// GET: api/Authors
[HttpGet]
public IEnumerable<Author> GetAuthors()
{
return _context.Authors;
}

// GET: api/Authors/5
[HttpGet("{id}")]
public async Task<IActionResult> GetAuthor([FromRoute] int id)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

var author = await _context.Authors.SingleOrDefaultAsync(m => m.AuthorId == id);

if (author == null)
{
return NotFound();
}

return Ok(author);
}

// PUT: api/Authors/5
[HttpPut("{id}")]
public async Task<IActionResult> PutAuthor([FromRoute] int id, [FromBody] Author author)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

if (id != author.AuthorId)
{
return BadRequest();
}

_context.Entry(author).State = EntityState.Modified;

try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!AuthorExists(id))
{
return NotFound();
}
else
{
throw;
}
}

return NoContent();
}

// POST: api/Authors
[HttpPost]
public async Task<IActionResult> PostAuthor([FromBody] Author author)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

_context.Authors.Add(author);
await _context.SaveChangesAsync();

return CreatedAtAction("GetAuthor", new { id = author.AuthorId }, author);
}

// DELETE: api/Authors/5
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteAuthor([FromRoute] int id)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}

var author = await _context.Authors.SingleOrDefaultAsync(m => m.AuthorId == id);
if (author == null)
{
return NotFound();
}

_context.Authors.Remove(author);
await _context.SaveChangesAsync();

return Ok(author);
}

private bool AuthorExists(int id)
{
return _context.Authors.Any(e => e.AuthorId == id);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="Models\" />
<Folder Include="wwwroot\images\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="EntityFrameworkCore.FirebirdSQL" Version="2.0.6-preview6" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Design" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>

</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading