rv77777
rv77777
CC#
Created by rv77777 on 8/2/2024 in #help
✅ (beginner) Align child to left, parent to the middle
!close
6 replies
CC#
Created by rv77777 on 8/2/2024 in #help
✅ (beginner) Align child to left, parent to the middle
Oh I am sorry
6 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
!close
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
After migrating I get an error Keyword not supported: '"server'.
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
Okay so after a while: I have this kind of connection string: "Server=.\SQLEXPRESS;Database=SchoolManagerDb;Trusted_Connection=True;"
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
into a database I want and folder I want
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
Yes I am using Migrations already, however I do not know how do I compose a connection string.
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
this is Program.cs as I'm into .net core 7
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
c#
using Microsoft.EntityFrameworkCore;
using SchoolManager.Services;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddDbContext<DatabaseContext>(options =>
{
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
options.UseSqlServer(connectionString);
}
);
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
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.Run();
c#
using Microsoft.EntityFrameworkCore;
using SchoolManager.Services;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddDbContext<DatabaseContext>(options =>
{
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
options.UseSqlServer(connectionString);
}
);
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
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.Run();
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
No description
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
I am using connection string as above and I am confused. There is this SQL Server Object Explorer - and on the left in VS I have sth like "Connected Services" - is this the same?
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
c#
builder.Services.AddDbContext<DatabaseContext>(options =>
{
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
options.UseSqlServer(connectionString);
}
);

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=.\\SQLEXPRESS;Database=YourDatabaseName;Trusted_Connection=True;"
}
}
c#
builder.Services.AddDbContext<DatabaseContext>(options =>
{
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
options.UseSqlServer(connectionString);
}
);

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=.\\SQLEXPRESS;Database=YourDatabaseName;Trusted_Connection=True;"
}
}
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
Yes I have the same kind of code. However - where do I read values such as Server (name), Initial Folder etc.?
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
yeah i'm using sql localdb
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
asp.net
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
SQLEXPRESS
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
SQL is SQL
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
wdym?
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
Yes: using Microsoft.EntityFrameworkCore; using SchoolManager.Models; namespace SchoolManager.Services { public class DatabaseContext : DbContext { public DatabaseContext(DbContextOptions options) : base(options) { } public DbSet<Student> Students { get; set; } public DbSet<Group> Groups { get; set; } } }
54 replies
CC#
Created by rv77777 on 5/6/2024 in #help
✅ Creation of a database (EF/CF)
yes
54 replies