-1
In my system I have class Context
to make the connection with the Bank, through the Entity Framework and I have a doubt, I should only use the public DbSet<NomedaClasse> Classe {get; set;}
if I’m doing my system by default Code First or can I use it normally? Sorry to ask, I’m new to programming!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data.Entity;
using CadastroAtivos.Models;
namespace CadastroAtivos.DAL
{
public class clsContext : DbContext
{
public clsContext() : base ("name=Stringconexao"){}
public DbSet<clsMarcaModel> dbMarcas { get; set; }
public DbSet<clsModeloModel> dbModelos { get; set; }
What is it to use normally? because it should always use normally, never irregularly. If you are new to programming you must first learn the basics, the basics, so you can understand the rest. Although it may seem that you are managing to do something, without understanding everything that is happening there from your base may be doing everything wrong and you are not even able to notice the mistakes. There is no novice messing with EP, at least not with property, so it is better to go back a few steps before.
– Maniero
You can set up a Context and point it out as a single connection key on your web.config
– Vinícius