2
In the version of ".Net Framework 4" I have a project that when using . edmx did the automatic generation of Edmschema where in my project I did so:
1 - ADO - (Project Class Library)
2 - Archive . edmx
3 - An Interface
using System;
using System.Linq;
using System.Linq.Expressions;
namespace LojaVirtual.DAO.Interfaces
{
public interface IBaseCRUD<T>
{
void Adicionar(T pEntity);
void Deletar(T pEntity);
void Attach(T pEntity);
void Detach(T pEntity);
void Update(T pEntity);
IQueryable<T> Selecionar(Expression<Func<T,bool>> where );
IQueryable<T> SelecionarTodos();
void Salvar();
}
}
4 - An Abstract:
using System;
using System.Linq;
using System.Linq.Expressions;
using LojaVirtual.DAO.Interfaces;
namespace LojaVirtual.DAO
{
public abstract class AbstractCRUD<T> :IBaseCRUD<T> where T:class
{
LOJAEntities loja = new LOJAEntities();
public void Adicionar(T pEntity)
{
loja.AddObject(pEntity.GetType().Name, pEntity);
}
public void Deletar(T pEntity)
{
loja.DeleteObject(pEntity);
}
public void Attach(T pEntity)
{
loja.AttachTo(pEntity.GetType().Name, pEntity);
}
public void Detach(T pEntity)
{
loja.Detach(pEntity);
}
public void Update(T pEntity)
{
loja.ApplyCurrentValues<T>(pEntity.GetType().Name, pEntity);
}
public IQueryable<T> Selecionar(Expression<Func<T, bool>> where)
{
return loja.CreateObjectSet<T>().Where(where);
}
public IQueryable<T> SelecionarTodos()
{
return loja.CreateObjectSet<T>();
}
public void Salvar()
{
loja.SaveChanges();
}
}
}
In the version of ".Net Framework 4.5" I have the same structure, more , my Abstractcrud can not access the information of Ibasecrud
Error:
Error CS1061 'Crud_mvcentities' does not contain a Definition for 'Addobject' and no Extension method 'Addobject' Accepting a first argument of type 'Crud_mvcentities' could be found (are you Missing a using Directive or an Assembly Reference? ) DAL C: Users name Downloads Project.Fileinput DAL Abstractcrud.Cs 15 Active
Does anyone know why? Thanks