This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pages/Post/Index.razor | |
@page "/posts" | |
@using Golb.Data | |
@using Golb.Services | |
@inject PostService service | |
@if (posts == null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... etc | |
using Golb.Services; | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
...etc | |
services.AddTransient<PostService>(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Services/PostService.cs | |
using Microsoft.EntityFrameworkCore; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using Golb.Data; | |
namespace Golb.Services | |
{ | |
public interface IPostService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select Name from sys.Databases | |
use GolbDatabase | |
select * from information_schema.tables | |
select * from information_schema.columns where table_name = 'Posts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/opt/mssql-tools/bin/sqlcmd -S localhost -U "sa" -P "yourPasswordHere" -I |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker exec -it sql_server bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Data/ApplicationDbContext.cs | |
public class ApplicationDbContext : IdentityDbContext | |
{ | |
...etc | |
public DbSet<Post> Posts { get; set; } | |
protected override void OnModelCreating(ModelBuilder builder) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Data/Post.cs | |
using System; | |
namespace Golb.Data | |
{ | |
public class Post | |
{ | |
public int Id { get; set; } | |
public string Title { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnet tool install --global dotnet-ef |