-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change structure of project #3
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ec833f2
feat: add src folder with 4 projects
HlibPavlyk 543645b
feat: add core entities
HlibPavlyk 87b334c
feat: add application infrastructure
HlibPavlyk a0c7fba
feat: add identity setup extentions
HlibPavlyk c629cc8
feat: build database
HlibPavlyk 8ea0325
fix: update packages
HlibPavlyk c10a846
feat: add Identity
HlibPavlyk f52e316
fix: add identity using
HlibPavlyk d0497f1
feat: add controllers with views
HlibPavlyk 1719546
fix: change mssql to in-memory database
HlibPavlyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace MTRPZ4.Application | ||
{ | ||
public class Class1 | ||
{ | ||
|
||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Microsoft.AspNetCore.Identity; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MTRPZ4.CoreDomain.Entities | ||
{ | ||
public class User : IdentityUser | ||
{ | ||
public bool IfCompletedTest { get; set; } | ||
|
||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.5" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore; | ||
using MTRPZ4.CoreDomain.Entities; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MTRPZ4.Infrastructure | ||
{ | ||
public class ApplicationDBContext : IdentityDbContext<User> | ||
{ | ||
|
||
public ApplicationDBContext(DbContextOptions<ApplicationDBContext> options) : base(options) { } | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ApplicationDBContext).Assembly); | ||
base.OnModelCreating(modelBuilder); | ||
} | ||
|
||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MTRPZ4.Infrastructure | ||
{ | ||
public static class ConnectionExtensions | ||
{ | ||
public static void AddDBConnection(this IServiceCollection service) | ||
{ | ||
IServiceCollection serviceCollection = service.AddDbContext<ApplicationDBContext>(options => | ||
options.UseInMemoryDatabase("_")); | ||
} | ||
} | ||
|
||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/MTRPZ4.Infrastructure/EntityTypeConfiguration/UserConfiguration.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
using Microsoft.EntityFrameworkCore; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using MTRPZ4.CoreDomain.Entities; | ||
|
||
namespace MTRPZ4.Infrastructure.EntityTypeConfiguration | ||
{ | ||
internal class UserConfiguration : IEntityTypeConfiguration<User> | ||
{ | ||
public void Configure(EntityTypeBuilder<User> builder) | ||
{ | ||
|
||
builder.Property(u => u.Email) | ||
.IsRequired(true); | ||
|
||
builder.Property(u => u.UserName) | ||
.HasMaxLength(30) | ||
.IsRequired(true); | ||
|
||
builder.Property(u => u.PasswordHash) | ||
.IsRequired(true); | ||
|
||
builder.Property(u => u.IfCompletedTest) | ||
.HasDefaultValue(false); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
| ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using MTRPZ4.CoreDomain.Entities; | ||
using MTRPZ4.Infrastructure; | ||
|
||
namespace CoinyProject.Shared.Extensions | ||
{ | ||
public static class IdentityExtensions | ||
{ | ||
public static void AddIdentityUser(this IServiceCollection service) | ||
{ | ||
service.AddDefaultIdentity<User>(options => options.SignIn.RequireConfirmedAccount = false) | ||
.AddEntityFrameworkStores<ApplicationDBContext>() | ||
.AddDefaultTokenProviders(); | ||
} | ||
|
||
public static void ConfigurateIdentityOptions(this IServiceCollection service) | ||
{ | ||
service.Configure<IdentityOptions>(options => | ||
{ | ||
options.Password.RequiredLength = 8; | ||
options.Password.RequireUppercase = false; | ||
}); | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.5" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.5" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.5" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.5"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.5" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.5" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.5"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MTRPZ4.DomainCore\MTRPZ4.CoreDomain.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't use .Application project, than just delete it.