This file contains hidden or 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
<template> | |
<div> | |
<span v-for='block, idx in blocks' v-bind:key='idx'> | |
<span>{{ block }}</span><span v-if='idx < blocks.length - 1'>, </span> | |
</span> | |
</div> | |
</template> | |
<script lang="ts"> | |
import { Vue, Options, Prop } from 'vue-decorator'; |
This file contains hidden or 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
using (var db = new Database()) { | |
db.Fruits.Add(new Models.Fruit { Name = "Apple", Weight = 345.2 }); | |
var tree = new Models.Tree { Height = 45 }; | |
tree.Fruits.Add(new Models.Fruit { Name = "Banana", Weight = 25.1 }); | |
db.Trees.Add(tree); | |
var count = db.SaveChanges(); | |
Console.WriteLine("{0} records saved to database", count); | |
} | |
using (var db = new Database()) { |
This file contains hidden or 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
class Database : DbContext { | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { | |
optionsBuilder.UseSqlite("Data Source=garden.db"); | |
} | |
public DbSet<Models.Fruit> Fruits { get; set; } | |
public DbSet<Models.Tree> Trees { get; set; } | |
} |
This file contains hidden or 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
<ItemGroup> | |
<PackageReference Include="Google.Protobuf" Version="3.7.0" /> | |
<PackageReference Include="Grpc.Tools" Version="1.20.1" /> | |
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0-preview4.19216.3"> | |
<PrivateAssets>all</PrivateAssets> | |
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |
</PackageReference> | |
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview4.19216.3" /> | |
</ItemGroup> |
This file contains hidden or 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
syntax = "proto3"; | |
package Models; | |
message Fruit { | |
int64 Id = 1; | |
string Name = 2; | |
double Weight = 3; | |
} | |
message Tree { |