I'm a C# beginner; I tried to create a project with a local database using Entity Framework but I get this exception:
System.Data.SqlClient.SqlException (0x80131904): Unix Connect System.Net.Sockets.SocketException (0x80004005): The socket is not connected
Here is my DbContext
class
namespace BibData
{
public class BibContext : DbContext
{
public BibContext() : base("BibliothequeDB")
{}
public DbSet<Auteur> auteurs { get; set; }
}
}
This is my program.cs
namespace BibConsole
{
internal class Program
{
public static void Main(string[] args)
{
BibContext ctx = new BibContext();
Auteur auteur = new Auteur
{
auteurId = 1, nom = "x", prenom = "y"
};
ctx.auteurs.Add(auteur);
ctx.SaveChanges();
}
}
}
and this is the exception
User contributions licensed under CC BY-SA 3.0