Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Done. To undo this action, use 'ef migrations remove'
PS C:\rojects\MyProject>
```

By default, the project applies database migrations on startup. If you want disable this behaviour, you can set appsettings.Local.json
By default, the project will NOT applies database migrations on startup. If you want enable this behaviour, you can set appsettings.Local.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will NOT apply*


```
{
Expand Down
2 changes: 1 addition & 1 deletion docs/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Done. To undo this action, use 'ef migrations remove'
PS C:\rojects\MyProject>
```

By default, the project applies database migrations on startup. If you want disable this behaviour, you can set appsettings.Local.json
By default, the project will NOT applies database migrations on startup. If you want enable this behaviour, you can set appsettings.Local.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will NOT apply*


```
{
Expand Down
6 changes: 3 additions & 3 deletions src/content/.frontier/template/query/query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace __PROJECT_NAME__.Application.Features.__FEATURE_NAME__.Queries.__QUERY_NAME__
{
public record __QUERY_NAME__Query : IRequest<string?>>
public record __QUERY_NAME__Query : IRequest<string?>
{
}

public class __QUERY_NAME__QueryHandler : IRequestHandler<__QUERY_NAME__Query, string?>>
public class __QUERY_NAME__QueryHandler : IRequestHandler<__QUERY_NAME__Query, string?>
{
// private readonly IAuthenticationService _authenticationService;

Expand All @@ -16,7 +16,7 @@ public __QUERY_NAME__QueryHandler(/*IAuthenticationService authenticationService
// _authenticationService = authenticationService;
}

public async ValueTask<string?>> Handle(__QUERY_NAME__Query request, CancellationToken cancellationToken)
public async ValueTask<string?> Handle(__QUERY_NAME__Query request, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Done. To undo this action, use 'ef migrations remove'
PS C:\rojects\MyProject>
```

By default, the project applies database migrations on startup. If you want disable this behaviour, you can set appsettings.Local.json
By default, the project will NOT applies database migrations on startup. If you want enable this behaviour, you can set appsettings.Local.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will NOT apply*


```
{
Expand Down
8 changes: 7 additions & 1 deletion src/content/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@ version: '3.4'

services:
webapi:
container_name: NetWebApiTemplate
build:
context: .
dockerfile: src/NetWebApiTemplate.Api/Dockerfile
environment:
- "ASPNETCORE_ENVIRONMENT=Local"
- "ASPNETCORE_URLS=https://+:44372;http://+:5000"
- "ConnectionStrings__DatabaseConnection=server=ms-sql-server;Database=applicationdb;User=sa;Password=Pa55w0rd2023;MultipleActiveResultSets=true;Encrypt=False"
- "ASPNETCORE_kestrel__Certificates__Default__Password=Password123"
- "ASPNETCORE_kestrel__Certificates__Default__Path=/https/aspnetapp.pfx"
ports:
- "5000:5000"
- "44372:44372"
volumes:
- ./src:/app/src
- ~/.aspnet/https:/https:ro
# Needed for Hot Reloading on Windows
- /app/src/obj/
- /app/src/bin/
- /app/src/NetWebApiTemplate.Api/obj/
- /app/src/NetWebApiTemplate.Api/bin/
depends_on:
- ms-sql-server
restart: on-failure
Expand Down
16 changes: 3 additions & 13 deletions src/content/src/NetWebApiTemplate.Api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Get base SDK Image from Microsoft
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
ARG Configuration=Release
ARG Configuration=Debug
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be two docker files? One for Debug and one for Release?

ENV DOTNET_CLI_TELEMETRY_OUTPUT=true \
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
WORKDIR /app
Expand All @@ -25,17 +25,7 @@ COPY src/NetWebApiTemplate.Application/. ./src/NetWebApiTemplate.Application/
COPY src/NetWebApiTemplate.Infrastructure/. ./src/NetWebApiTemplate.Infrastructure/
COPY src/NetWebApiTemplate.Persistence/. ./src/NetWebApiTemplate.Persistence/

# Build and publish app
WORKDIR /app/src/NetWebApiTemplate.Api
RUN dotnet publish -c $Configuration -o out

# Generate runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine
# install cultures
RUN apk add --no-cache icu-libs
# Disbale the invariant mode "set in base image"
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
WORKDIR /app
EXPOSE 80 443
COPY --from=build-env /app/src/NetWebApiTemplate.Api/out ./
ENTRYPOINT ["dotnet", "NetWebApiTemplate.Api.dll"]

ENTRYPOINT ["dotnet", "watch", "run", "--project" , "NetWebApiTemplate.Api.csproj", "--urls", "https://*:44372;http://*:5000"]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"UseDatabaseInitializer": true,
"UseDatabaseInitializer": false,
"Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Console" ],
"MinimumLevel": {
Expand Down Expand Up @@ -68,7 +68,7 @@
]
},
"ConnectionStrings": {
"DatabaseConnection": "server=ms-sql-server;Database=applicationdb;User=sa;Password=Pa55w0rd2023;MultipleActiveResultSets=true;Encrypt=False"
"DatabaseConnection": "server=ms-sql-server;Database=applicationdbdev;User=sa;Password=Pa55w0rd2023;MultipleActiveResultSets=true;Encrypt=False"
},
"EmailSenderOptions": {
"FromEmail": "",
Expand Down
4 changes: 2 additions & 2 deletions src/content/src/NetWebApiTemplate.Api/appsettings.Local.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"UseDatabaseInitializer": true,
"UseDatabaseInitializer": false,
"Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Console" ],
"MinimumLevel": {
Expand Down Expand Up @@ -68,7 +68,7 @@
]
},
"ConnectionStrings": {
"DatabaseConnection": "Server=(localdb)\\MSSQLLocalDB;Database=application_db;Trusted_Connection=True;MultipleActiveResultSets=true"
"DatabaseConnection": "server=ms-sql-server;Database=applicationdblocal;User=sa;Password=Pa55w0rd2023;MultipleActiveResultSets=true;Encrypt=False"
},
"EmailSenderOptions": {
"FromEmail": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"UseDatabaseInitializer": true,
"UseDatabaseInitializer": false,
"Serilog": {
"Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Console" ],
"MinimumLevel": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface INetWebApiTemplateDbContext
{
DbSet<Faq> Faqs { get; set; }
DbSet<Product> Products { get; set; }
DbSet<ProductCatergory> ProductCatergories { get; set; }
DbSet<ProductCategory> ProductCategories { get; set; }
DbSet<RefreshToken> RefreshTokens { get; set; }

Task<int> SaveChangesAsync(CancellationToken cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class Product
public string ProductName { get; set; } = string.Empty;
public string ProductDescription { get; set; } = string.Empty;
public decimal ProductPrice { get; set; }
public ProductCatergory ProductCatergory { get; set; } = new ProductCatergory();
public ProductCategory ProductCategory { get; set; } = new ProductCategory();

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NetWebApiTemplate.Domain.Entities
{
public class ProductCatergory
public class ProductCategory
{
public int CategoryId { get; set; }
public string CategoryName { get; set; } = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace NetWebApiTemplate.Persistence.Configurations
{
public class ProductCategoryConfiguration : IEntityTypeConfiguration<ProductCatergory>
public class ProductCategoryConfiguration : IEntityTypeConfiguration<ProductCategory>
{
public void Configure(EntityTypeBuilder<ProductCatergory> builder)
public void Configure(EntityTypeBuilder<ProductCategory> builder)
{
builder.HasKey(e => e.CategoryId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class NetWebApiTemplateDbContext : IdentityDbContext<ApplicationUser>, IN

public DbSet<Faq> Faqs { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<ProductCatergory> ProductCatergories { get; set; }
public DbSet<ProductCategory> ProductCategories { get; set; }
public DbSet<RefreshToken> RefreshTokens { get; set; }

public NetWebApiTemplateDbContext(DbContextOptions<NetWebApiTemplateDbContext> options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ INNER JOIN ProductCategories pc ON p.CategoryID
;

using var sqlconnection = _connectionFactory.CreateConnection();
var entity = await sqlconnection.QueryAsync<Product, ProductCatergory, Product>
var entity = await sqlconnection.QueryAsync<Product, ProductCategory, Product>
(sql, (product, productCategory) =>
{
product.ProductCatergory = productCategory;
product.ProductCategory = productCategory;
return product;
},
splitOn: "CategoryID");
Expand Down