Skip to content

Commit

Permalink
Database creation works. Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
horde-lord committed Jun 30, 2024
1 parent 9adecad commit 15dc20c
Show file tree
Hide file tree
Showing 20 changed files with 679 additions and 55 deletions.
14 changes: 14 additions & 0 deletions Core/Domains/Admin/AdminModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Autofac;

namespace Horde.Core.Domains.Admin
{
public class AdminModule: Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<TenantManager>().AsSelf().AsImplementedInterfaces()
.InstancePerLifetimeScope();
base.Load(builder);
}
}
}
2 changes: 2 additions & 0 deletions Core/Domains/Economy/EconomyModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Horde.Core.Domains.Economy.Entities;
using Horde.Core.Domains.Economy.Services;
using Horde.Core.Domains.World.Services;
using Horde.Core.Interfaces.Data;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -20,6 +21,7 @@ protected override void Load(ContainerBuilder builder)
builder.RegisterType<CurrencyService>().AsImplementedInterfaces().InstancePerLifetimeScope();
builder.RegisterType<ActivityService>().AsImplementedInterfaces().InstancePerLifetimeScope();
builder.RegisterType<PaymentService>().AsImplementedInterfaces().InstancePerLifetimeScope();

}
}
}
2 changes: 1 addition & 1 deletion Core/Domains/World/Entities/Company.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Horde.Core.Domains.World.Entities
public class Company: Team
{

public Country Country { get; set; }
//public Country Country { get; set; }
public int CountryId { get; set; }
public string RegistrationId { get; set; }
public string TaxId { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Core/Domains/World/Entities/Team.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Team() { }
public string ImageUrl { get; set; }
public int? ConversationId { get; set; }
public int? CountryId { get; set; }
public Country BaseCountry { get; set; }
//public Country BaseCountry { get; set; }
public Conversation Conversation { get; set; }
}

Expand Down
5 changes: 4 additions & 1 deletion Core/Domains/World/Services/WorldService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public WorldService(ILifetimeScope scope) : base(scope, ContextNames.World)

public void Init()
{
throw new NotImplementedException();

//create partner
//create create currency

}
}
}
2 changes: 1 addition & 1 deletion Core/Interfaces/Data/IEntityContextRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface IEntityContextRepository<out TContext> where TContext : IEntity
IQueryable<TEntity> GetQueryable<TEntity>(List<string> includes = null) where TEntity : BaseEntity;
IQueryable<TEntity> GetQueryable<TEntity>(params string[] includes) where TEntity : BaseEntity;
Task SaveChanges();
TEntity Find<TEntity>(int id) where TEntity : BaseEntity;
TEntity? Find<TEntity>(int id) where TEntity : BaseEntity;
bool IsAlreadyAttached<TEntity>(TEntity entity) where TEntity : BaseEntity;
void Upsert<TEntity>(TEntity entity) where TEntity : BaseEntity;
void UpsertRange<TEntity>(IEnumerable<TEntity> entities) where TEntity : BaseEntity;
Expand Down
4 changes: 1 addition & 3 deletions Core/Services/BaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ public BaseService(ILifetimeScope scope, ContextNames name = ContextNames.World)
Scope = scope;
Configuration = scope.Resolve<IConfiguration>();
Http = scope.Resolve<IHttpClientFactory>().CreateClient();
//var cm = new ConfigurationManager();
//cm.AddJsonFile("appsettings.json");
//Configuration = cm;

_tenantManager = scope.Resolve<TenantManager>();
_defaultContext = name;
}
Expand Down
6 changes: 3 additions & 3 deletions Examples/Data/AdminContext.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using Horde.Core.Interfaces.Data;
using Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
using Horde.Core.Domains.Admin.Entities;
using Microsoft.Extensions.Configuration;

namespace Infrastructure.DataContexts
namespace Examples.Data
{
public class AdminContext : EfCoreContext
{

public AdminContext(DbContextOptions options) : base(options) { }
public AdminContext(IConfiguration configuration) : base(configuration) { }

public override ContextNames Name => ContextNames.Admin;
public DbSet<Tenant> Tenants { get; set; }
Expand Down
11 changes: 6 additions & 5 deletions Examples/Data/CommerceContext.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using Horde.Core.Interfaces.Data;
using Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
using Horde.Core.Domains.Commerce;
using Microsoft.Extensions.Configuration;

namespace Infrastructure.DataContexts
namespace Examples.Data
{
public class CommerceContext : EfCoreContext
{
public override ContextNames Name => ContextNames.Commerce;
public CommerceContext(DbContextOptions options) : base(options)
{
}
public CommerceContext(IConfiguration configuration) : base(configuration) { }
//public CommerceContext(DbContextOptions options) : base(options)
//{
//}
public DbSet<Order> Orders { get; set; }
public DbSet<OrderItem> OrderItems { get; set; }
public DbSet<OrderItemTransaction> OrderItemTransactions { get; set; }
Expand Down
Loading

0 comments on commit 15dc20c

Please sign in to comment.