Comments (4)
You could make it conditional by passing an arg when starting the app:
if (app.Environment.IsDevelopment() && args.Contains("--init"))
{
await app.InitialiseDatabaseAsync();
}
Then you should be able to run it using:
dotnet run --init
This will allow for a dev to remove a migration and allow them to choose when they want to initialise the app.
from cleanarchitecture.
You could make it conditional by passing an arg when starting the app:
if (app.Environment.IsDevelopment() && args.Contains("--init")) { await app.InitialiseDatabaseAsync(); }Then you should be able to run it using:
dotnet run --initThis will allow for a dev to remove a migration and allow them to choose when they want to initialise the app.
I think this is not perfect solution when you run app directly from Visual Studio instead of Command Line
from cleanarchitecture.
You shouldnt need to seed your db every time you run your app.
from cleanarchitecture.
I found issue and resolved this.
NSwag AfterTargets="PostBuildEvent"
make app run one more time beforedotnet ef migrations remove
run
Resolved by: Check app run by NSwag ignore InitialiseDatabaseAsync
method
if (app.Environment.IsDevelopment())
{
var lineArgs = Environment.GetCommandLineArgs();
if(!lineArgs.Any(p => p.Contains("NSwag.AspNetCore.Launcher.dll")))
{
await app.InitialiseDatabaseAsync();
}
}
from cleanarchitecture.
Related Issues (20)
- Add Web.GrpcServer [gRPC Server] HOT 1
- Can not get Entity.Id on Events (always 0) HOT 1
- Migrations Issues
- Angular 17, standalone HOT 2
- Can't create migrations HOT 2
- Swagger Specifications are incomplete
- FluentValidation not triggered HOT 2
- upgrade angular spa client to 17 HOT 2
- Angular 17 post data to dotnet core8. Json deserialisation of bool failed HOT 1
- Implement Universal Reflection-Driven MappingProfile for Cleaner DTOs HOT 1
- Azure.Identity 1.10.4 moderate severity vulnerability HOT 5
- Default password seeding not working properly
- SqlException: Invalid object name 'Serilogs'. HOT 2
- {"type":"https://tools.ietf.org/html/rfc7231#section-6.6.1","title":"An error occurred while processing your request.","status":500}
- Could I use file .env following ASPNETCORE_ENVIRONMENT ?
- ✨ Add PostgreSQL support
- LoggingBehaviour in the Application project doesn't do anything
- Internal server error if a invalid parameter is sent on the route
- Boilerplate without "test" entities such as TodoListItem, TodoList and WheaterForecast
- Replace AutoMapper with Mapperly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cleanarchitecture.