✅ How to create a database for an application on mac?
The application’s purpose is to allow entry and editing of customer details
39 Replies
What kind of a database?
SQLIte? PostgreSQL? SQL Server?
for dotnet project
i am using visual studio for mac atm
you have to chose a database engine
A dotnet project can use any database
So, again, which one?
i tried using XAMPP and phpmyadmin
Yes, you can run a MySQL database through XAMPP
but I cant follow at 17.40
tried using chatgpt
but still i got this error "Option 'cache' not supported"
You can try Mssql management studio for mac? Setup? Maybe ? for mssql tsql
i think I have to be in "(base)" in terminal? not im not sure how
show how your register your dbcontext
You need to be in your project's directory
In the project that has the DbContext, to be more precise
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using ardonagh.Data;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
//builder.Services.AddDbContext<ApplicationDbContext>(options =>
// options.UseSqlite(connectionString));
builder.Services.AddDbContextPool<ApplicationDbContext>(options =>
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddControllersWithViews();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseMigrationsEndPoint();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapRazorPages();
app.Run();
what's your connection string ?
That seems fine
What is the exact error you're getting?
bernicefy#1744
i am using visual studio for mac atm
Quoted by
<@689473681302224947> from #How to create a database for an application on mac? (click here)
React with ❌ to remove this embed.
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Should have no bearing on the errors thrown from a dotnet tool ran via CLI, should it?
But, yeah, VS4Mac is dead
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
the devkit vscode extension has been release btw
SSMS does not exist for macOS
closest thing would be Azure Data Studio
this is the error after i enter "dotnet ef migrations add Customer"
Will it fix the problem if i switch to Azure Data Studio instead of XAMPP?
no
ADS is a database client
not a database engine
hmm.. so what should I do? I am stuck here..
what's the line 13 ?
try removing it
still the same error
is this the cause of the problem?
No, unlikely
so it's a a database engine problem?
It seems that way, yeah
Like MySQL wasn't supporting whatever option
What version of MySQL do you have installed?
AHHH
thank youuuu for reminding
its working now :'))
what did you change ?
SQL connection
From MySQL Workbench
oh the connectionstring ?
yup
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View