kunio_kun
kunio_kun
CC#
Created by Mekasu0124 on 5/24/2023 in #help
✅ How to make program wait before executing next print line?
When they clone your repo, all packages from nuget can be restored with dotnet restore command, which the IDE usually does during project open, so you dont actually need to do the steps like you did in python
56 replies
CC#
Created by Mekasu0124 on 5/24/2023 in #help
✅ How to make program wait before executing next print line?
So references are actually specified in the project file, .csproj if its c#
56 replies
CC#
Created by Mekasu0124 on 5/24/2023 in #help
✅ How to make program wait before executing next print line?
When you build or publish your application, all required libraries are included on the output directory.
56 replies
CC#
Created by Mekasu0124 on 5/24/2023 in #help
✅ How to make program wait before executing next print line?
It only happens when you are debugging if i remember correctly
56 replies
CC#
Created by RobinTTY on 5/24/2023 in #help
❔ Nullable bools
I usually always use the .Value of a Nullable<T>
70 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
Thanks you for your responses
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
To sum it up, i need to
builder.Services.AddSpaStaticFiles(config => {
config.RootPath = "client";
});
builder.Services.AddSpaStaticFiles(config => {
config.RootPath = "client";
});
then after the UseStaticFiles
app.UseStaticFiles();
app.MapWhen(context =>
context.Request.Path.Value is not null && !(context.Request.Path.Value.StartsWith("/api") ||
context.Request.Path.Value.StartsWith("/swagger") ||
context.Request.Path.Value.StartsWith("/_client") ||
context.Request.Path.Value.StartsWith("/user")),
appBuilder => {
appBuilder.UseSpaStaticFiles();
appBuilder.UseSpa(_ => {
});
});
app.UseStaticFiles();
app.MapWhen(context =>
context.Request.Path.Value is not null && !(context.Request.Path.Value.StartsWith("/api") ||
context.Request.Path.Value.StartsWith("/swagger") ||
context.Request.Path.Value.StartsWith("/_client") ||
context.Request.Path.Value.StartsWith("/user")),
appBuilder => {
appBuilder.UseSpaStaticFiles();
appBuilder.UseSpa(_ => {
});
});
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
okay i fixed it, apparently
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
yeah, it's already there
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
A moment ago i got it working, not its not. It now serves index.html, but when other files are requested, it says file not found while it is there
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
I appreciate your response
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
and I could go to localhost:port/index.html and have index.html loaded in the browser
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
It still complains the same thing, however the client folder exists on the project directory, and in bin\Debug\net7.0 directory, I can explorer the\path\it\complains\not\found and it is there
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
By the way, I am trying another approach with the SpaExtensions, now the startup order looks like
// other configurations
WebApplication app = builder.Build();
app.UseCors(options => {
options.AllowAnyOrigin();
options.AllowAnyHeader();
options.AllowAnyMethod();
});
app.UseStaticFiles();
Console.WriteLine(Path.Join(app.Environment.ContentRootPath, "client"));
app.UseSpaStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Join(app.Environment.ContentRootPath, "client")),
RequestPath = ""
});
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();

// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI();
// more configurations
// other configurations
WebApplication app = builder.Build();
app.UseCors(options => {
options.AllowAnyOrigin();
options.AllowAnyHeader();
options.AllowAnyMethod();
});
app.UseStaticFiles();
Console.WriteLine(Path.Join(app.Environment.ContentRootPath, "client"));
app.UseSpaStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(Path.Join(app.Environment.ContentRootPath, "client")),
RequestPath = ""
});
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();

// Configure the HTTP request pipeline.
app.UseSwagger();
app.UseSwaggerUI();
// more configurations
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
Do you have any tips to diagnose this situation?
24 replies
CC#
Created by kunio_kun on 5/13/2023 in #help
❔ Serving SPA on ASP.NET Core MVC Web API
I can verify the folder exists
24 replies
CC#
Created by Grits on 4/12/2023 in #help
❔ PlayStation 2 startup recreation
Could you elaborate on what you're trying to do?
5 replies
CC#
Created by kunio_kun on 4/5/2023 in #help
✅ Inserting record with one-to-many relationship EF Core
Not yet
34 replies
CC#
Created by kunio_kun on 4/5/2023 in #help
✅ Inserting record with one-to-many relationship EF Core
and it throws
An unhandled exception occurred while processing the request.
SqliteException: SQLite Error 19: 'FOREIGN KEY constraint failed'.
Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(int rc, sqlite3 db)

DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
An unhandled exception occurred while processing the request.
SqliteException: SQLite Error 19: 'FOREIGN KEY constraint failed'.
Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(int rc, sqlite3 db)

DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
34 replies
CC#
Created by kunio_kun on 4/5/2023 in #help
✅ Inserting record with one-to-many relationship EF Core
Now trying to insert it like
List<Pekerjaan> daftarPekerjaan = viewModel.DaftarPekerjaan.Select(p => new Pekerjaan()
{
Keterangan = p.Keterangan,
Nominal = p.Nominal
})
.ToList();

Db.Pekerjaan.AddRange(daftarPekerjaan);

Invoice invoiceBaru = new Invoice()
{
NomorInvoice = nomorInvoice,
DaftarPekerjaan = daftarPekerjaan,
UsernamePembuka = username,
StatusInvoice = StatusInvoice.BelumDikerjakan,
TanggalInvoice = DateTime.Now
};

Db.Invoice.Add(invoiceBaru);

await Db.SaveChangesAsync();
List<Pekerjaan> daftarPekerjaan = viewModel.DaftarPekerjaan.Select(p => new Pekerjaan()
{
Keterangan = p.Keterangan,
Nominal = p.Nominal
})
.ToList();

Db.Pekerjaan.AddRange(daftarPekerjaan);

Invoice invoiceBaru = new Invoice()
{
NomorInvoice = nomorInvoice,
DaftarPekerjaan = daftarPekerjaan,
UsernamePembuka = username,
StatusInvoice = StatusInvoice.BelumDikerjakan,
TanggalInvoice = DateTime.Now
};

Db.Invoice.Add(invoiceBaru);

await Db.SaveChangesAsync();
34 replies