Skip to content

Commit

Permalink
[OData.Sample]: added Author and Publisher controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfabian committed Jan 6, 2024
1 parent c2dc79d commit 532c1be
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ private static void RegisterRepositories(ContainerBuilder builder)
.As<IRepository<Product>>()
.InstancePerLifetimeScope();

builder.RegisterType<PublishersRepository>()
.As<IRepository<Publisher>>()
.InstancePerLifetimeScope();

builder.RegisterType<AuthorsRepository>()
.As<IRepository<Author>>()
.InstancePerLifetimeScope();

builder.RegisterType<BooksMappedRepository>()
.AsSelf()
.InstancePerLifetimeScope();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Joker.Contracts.Data;
using Joker.OData.Controllers;
using Sample.DataCore.EFCore;
using Sample.Domain.Models;

namespace SelfHostedODataService.EFCore.Controllers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Joker.Contracts.Data;
using Joker.OData.Controllers;
using Sample.DataCore.EFCore;
using Sample.Domain.Models;

namespace SelfHostedODataService.EFCore.Controllers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Controllers\AuthorsController.cs" />
<Compile Remove="Controllers\PublishersController.cs" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\SelfHostedODataService\HostedServices\ProductChangesHostedService.cs" Link="HostedServices\ProductChangesHostedService.cs" />
<Compile Include="..\SelfHostedODataService\SignalR\Hubs\DataChangesHub.cs" Link="SignalR\Hubs\DataChangesHub.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using Autofac;
using AutoMapper;
using Joker.Factories.Schedulers;
using Joker.OData.Batch;
using Joker.OData.Extensions.OData;
Expand Down Expand Up @@ -39,6 +38,10 @@ protected override ODataModelBuilder OnCreateEdmModel(ODataModelBuilder oDataMod

oDataModelBuilder.AddPluralizedEntitySet<Product>();
oDataModelBuilder.AddPluralizedEntitySet<Book>();
oDataModelBuilder.AddPluralizedEntitySet<Author>();
oDataModelBuilder.AddPluralizedEntitySet<Publisher>();

oDataModelBuilder.EntityType<Publisher>().HasKey(c => new { c.PublisherId1, c.PublisherId2 });

return oDataModelBuilder;
}
Expand Down

0 comments on commit 532c1be

Please sign in to comment.