Skip to the content

EFCore things

We all love EFCore.


To create your code-first from database you should do the following:

Now it's time to create the EF model based on your existing database.

  • Tools –> NuGet Package Manager –> Package Manager Console
  • Run the following command to create a model from the existing database:

Scaffold-DbContext "Server=instance;Database=dbname;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models


select pm.PolicyNumber, RenovationProposer.PolicyTitle from RenovationProposer
join RenovationRisk rr on rr.RenovationProposerId = RenovationProposer.RenovationProposerId
join PolicyMaster pm on pm.LiveRiskID = rr.RiskID
where RenovationProposer.RenovationProposerId in (
select RenovationProposerId from RenovationRisk as Risk
where RiskID in (
select LiveRiskID from PolicyMaster
WHERE PolicyMasterID in (
select fc.PolicyMasterID from FinanceTransfer as fc
INNER JOIN PolicyHistory as ph
ON fc.PolicyHistoryID = ph.PolicyHistoryID where ph.CreationDate >= '2018-09-01' AND ph.CreationDate <= '2018-11-30'


Light window Image
Tech Agnosticism

The team know their stuff. We went from an on-prem application to SaaS within 18 months. They get tech and us.

Managing Director - FTSE250 Company


Kemp House, 160 City Road, 
London, Greater London EC1V 2NX

0808 143 0699


If you want to talk agile, tech or want to sound off then contact us on 0800 689 1376