Skip to content

Commit

Permalink
Updated sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
horde-lord committed Jun 30, 2024
1 parent 0f9dc85 commit beb2357
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
19 changes: 17 additions & 2 deletions Core/Domains/World/Services/WorldService.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using Autofac;
using Horde.Core.Domains.Admin.Entities;
using Horde.Core.Domains.World.Entities;
using Horde.Core.Interfaces.Data;
using Horde.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

Expand All @@ -15,10 +18,22 @@ public WorldService(ILifetimeScope scope) : base(scope, ContextNames.World)
{
}

public void Init()
public async Task Init()
{

//Create owner
var me = new User()
{
Username = "Me",

};
me = await Get<RegistrationService>().SearchOrCreateRegistration(me);
//create partner
var myOrg = new Tenant()
{
Key = "me",
Name = "Me",

}

Check failure on line 36 in Core/Domains/World/Services/WorldService.cs

View workflow job for this annotation

GitHub Actions / build

; expected

Check failure on line 36 in Core/Domains/World/Services/WorldService.cs

View workflow job for this annotation

GitHub Actions / build

; expected
//create create currency

}
Expand Down
4 changes: 4 additions & 0 deletions Examples/Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions Examples/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Add-Migration add-currency -Context EconomyContext
Script-Migration 0 add-currency -Context AdminContext

Add-Migration add-admin -Context AdminContext
Script-Migration 0 add-admin -Context AdminContext
6 changes: 4 additions & 2 deletions Examples/TestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ public TestService(ILifetimeScope scope) : base(scope, ContextNames.World)
{
}

public Task StartAsync(CancellationToken cancellationToken)
public async Task StartAsync(CancellationToken cancellationToken)
{
//Initialize and migrate sqlite
GetRepository(ContextNames.World).CreateDatabase();
Get<WorldService>().Init();
//run migrations as explained in readme

await Get<WorldService>().Init();
return Task.CompletedTask;
}

Expand Down

0 comments on commit beb2357

Please sign in to comment.