Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
HIAST-Clinics
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
almohanad.hafez
HIAST-Clinics
Commits
4382139b
Commit
4382139b
authored
Aug 17, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(B) Update assemblies references, and link them to program.cs
parent
ead3c9e3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
11 deletions
+42
-11
API.csproj
Clinics.Backend/API/API.csproj
+1
-0
Program.cs
Clinics.Backend/API/Program.cs
+19
-7
AssemblyReference.cs
Clinics.Backend/Application/AssemblyReference.cs
+8
-0
AssemblyReference.cs
Clinics.Backend/Persistence/AssemblyReference.cs
+8
-0
AssemblyReference.cs
Clinics.Backend/Presentation/AssemblyReference.cs
+6
-4
No files found.
Clinics.Backend/API/API.csproj
View file @
4382139b
...
...
@@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
...
...
Clinics.Backend/API/Program.cs
View file @
4382139b
using
API.Options.Database
;
using
Domain.Repositories.Base
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.Extensions.Options
;
using
Persistence.Context
;
using
Persistence.Repositories.Base
;
var
builder
=
WebApplication
.
CreateBuilder
(
args
);
...
...
@@ -32,15 +30,29 @@ builder.Services.AddDbContext<ClinicsDbContext>(
// Add services to the container.
#region Link repositories
// AddTransient: Created on demand, every time they are requested, not shared across requests or components.
builder
.
Services
.
AddTransient
(
typeof
(
IRepository
<>),
typeof
(
Repositroy
<>));
#region Link interfaces implemented in persistence
// Using Scrutor library
builder
.
Services
.
Scan
(
selector
=>
selector
.
FromAssemblies
(
Persistence
.
AssemblyReference
.
Assembly
// Add other assemblies here
)
.
AddClasses
(
false
)
.
AsImplementedInterfaces
()
.
WithScopedLifetime
()
);
#endregion
#region Add MadiatR
builder
.
Services
.
AddMediatR
(
configuration
=>
configuration
.
RegisterServicesFromAssembly
(
Application
.
AssemblyReference
.
Assembly
));
#endregion
#region Link controllers with presentation layer
var
presentationAssembly
=
typeof
(
Presentation
.
AssemblyReference
).
Assembly
;
builder
.
Services
.
AddControllers
()
.
AddApplicationPart
(
presentation
Assembly
);
.
AddApplicationPart
(
Presentation
.
AssemblyReference
.
Assembly
);
#endregion
...
...
Clinics.Backend/Application/AssemblyReference.cs
0 → 100644
View file @
4382139b
using
System.Reflection
;
namespace
Application
;
public
class
AssemblyReference
{
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
Clinics.Backend/Persistence/AssemblyReference.cs
0 → 100644
View file @
4382139b
using
System.Reflection
;
namespace
Persistence
;
public
class
AssemblyReference
{
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
Clinics.Backend/Presentation/AssemblyReference.cs
View file @
4382139b
namespace
Presentation
using
System.Reflection
;
namespace
Presentation
;
public
class
AssemblyReference
{
public
class
AssemblyReference
{
}
public
static
readonly
Assembly
Assembly
=
typeof
(
AssemblyReference
).
Assembly
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment