1
I needed to change an application made some time ago in C# Asp.net. I added the column in the database I needed and when I add the corresponding field to the model, when running the application it no longer identifies me as a user. (The application uses windows Authentication) And when entering any menu of the application, returns me the following error:
The mapping and metadata information of Entitycontainer 'Context' no longer corresponds to the information used to create the pre-generated views.
What do I need to do to get the application started and add the new fields I need? Codefirst was used to create the application.
EDIT
When running the Enable-Migration command, a folder named Migration was created in my application with the following configuration:
namespace GAWeb.WebApp.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
internal sealed class Configuration : DbMigrationsConfiguration</* TODO: put your Code First context type name here */DbContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(/* TODO: put your Code First context type name here */ )
{
...
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataIntegration.Model.Entities;
namespace DataIntegration.Model.Repositories
{
public interface IUnitOfWork : IDisposable
{
IRepository<IAccount> Accounts { get; }
IRepository<IBudget> Budgets { get; }
IRepository<IEmployee> Employees { get; }
IRepository<IInvoice> Invoices { get; }
IRepository<IItem> Items { get; }
IRepository<IRequest> Requests { get; }
IRepository<IRequestHistory> RequestsHistory { get; }
IRepository<IRequestItem> RequestItems { get; }
IRepository<IResultCenter> ResultCenters { get; }
IRepository<IUnit> Units { get; }
void Save();
void Dispose(bool disposing);
}
}
namespace GAWeb.VoucherRequests.Model.Repositories
{
public class UnitOfWork : IUnitOfWork
{
private Context context = new Context();
private GenericRepository<Employee> employees;
private GenericRepository<Invoice> invoices;
private GenericRepository<Voucher> items;
private GenericRepository<Request> requests;
private GenericRepository<RequestHistory> requestsHistory;
private GenericRepository<RequestItem> requestItems;
private GenericRepository<ResultCenter> resultCenters;
private GenericRepository<Unit> units;
public IRepository<Unit> Units
{
get
{
if (units == null)
units = new GenericRepository<Unit>(context);
return units;
}
}
IRepository<IEmployee> IUnitOfWork.Employees { get { return Employees as IRepository<IEmployee>; } }
IRepository<IInvoice> IUnitOfWork.Invoices { get { return Invoices as IRepository<IInvoice>; } }
IRepository<IItem> IUnitOfWork.Items { get { return Items as IRepository<IItem>; } }
IRepository<IRequest> IUnitOfWork.Requests { get { return Requests as IRepository<IRequest>; } }
IRepository<IRequestHistory> IUnitOfWork.RequestsHistory { get { return RequestsHistory as IRepository<IRequestHistory>; } }
IRepository<IRequestItem> IUnitOfWork.RequestItems { get { return RequestItems as IRepository<IRequestItem>; } }
IRepository<IResultCenter> IUnitOfWork.ResultCenters { get { return ResultCenters as IRepository<IResultCenter>; } }
IRepository<IUnit> IUnitOfWork.Units { get { return Units as IRepository<IUnit>; } }
This is the Entitites I want to change:
using System;
namespace DataIntegration.Model.Entities
{
public interface IRequestItem : IEntity
{
int Id { get; set; }
DateTime? Date { get; set; }
DateTime Data_Retorno { get; set; } // Esse é um campo que quero acrescentar a aplicação e ao banco
int Quantity { get; set; }
string Employee_Id { get; set; }
IEmployee Employee { get; set; }
string Unit_Id { get; set; }
IUnit Unit { get; set; }
string ResultCenter_Id { get; set; }
IResultCenter ResultCenter { get; set; }
int TaxiRequest_Id { get; set; }
IRequest Request { get; set; }
}
}
Context class
public class Context : DbContext, IDisposable
{
public Context()
: base(DatabaseInfo.CONNECTION_STRING)
{
Configuration.ValidateOnSaveEnabled = false;
}
public bool Validate<T>(T entity) where T : class
{
return ValidateEntity(Entry(entity), null).IsValid;
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
//TABLE MAPS
modelBuilder.Entity<Unit>().ToTable(DatabaseInfo.UNITS_TABLE);
modelBuilder.Entity<ResultCenter>().ToTable(DatabaseInfo.CENTERS_TABLE);
modelBuilder.Entity<Employee>().ToTable(DatabaseInfo.EMPLOYEES_TABLE);
modelBuilder.Entity<Request>().ToTable(DatabaseInfo.TAXI_REQUEST_TABLE);
modelBuilder.Entity<Voucher>().ToTable(DatabaseInfo.VOUCHERS_TABLE);
modelBuilder.Entity<RequestItem>().ToTable(DatabaseInfo.REQUEST_ITEM_TABLE);
modelBuilder.Entity<Invoice>().ToTable(DatabaseInfo.TAXI_INVOICE_TABLE);
modelBuilder.Entity<RequestHistory>().ToTable(DatabaseInfo.REQUEST_HISTORY_TABLE);
}
public DbSet<Invoice> Invoices { get; set; }
}
}
Generic Repository
namespace GAWeb.VoucherRequests.Model.Repositories
{
public class GenericRepository<TEntity> : IRepository<TEntity> where TEntity : class, IEntity
{
private Context context;
private DbSet<TEntity> dbSet;
public GenericRepository(Context context)
{
this.context = context;
this.dbSet = context.Set<TEntity>();
}
public virtual bool IsValid(TEntity entity)
{
return context.Validate(entity);
}
public virtual IEnumerable<TEntity> Get(
Expression<Func<TEntity, bool>> filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
params string[] includeProperties)
{
IQueryable<TEntity> query = dbSet;
if (filter != null)
{
query = query.Where(filter);
}
foreach (var includeProperty in includeProperties)
{
query = query.Include(includeProperty);
}
if (orderBy != null)
{
return orderBy(query).ToList();
}
else
{
return query.ToList();
}
}
public virtual TEntity GetByID(object id)
{
return dbSet.Find(id);
}
public virtual TEntity GetLoadedByID(object id)
{
return dbSet.Local.Single(x => x.Id.Equals(id));
}
public virtual void Insert(TEntity entity)
{
dbSet.Add(entity);
}
public virtual void Delete(object id)
{
TEntity entityToDelete = dbSet.Find(id);
Delete(entityToDelete);
}
public virtual void Delete(TEntity entityToDelete)
{
if (context.Entry(entityToDelete).State == EntityState.Detached)
{
dbSet.Attach(entityToDelete);
}
dbSet.Remove(entityToDelete);
}
public virtual void Update(TEntity entityToUpdate)
{
dbSet.Attach(entityToUpdate);
context.Entry(entityToUpdate).State = EntityState.Modified;
}
public void Clear()
{
throw new NotImplementedException();
}
}
}
Context.Views
//------------------------------------------------------------------------------
// <auto-generated>
// O código foi gerado por uma ferramenta.
// Versão de Tempo de Execução:4.0.30319.544
//
// As alterações ao arquivo poderão causar comportamento incorreto e serão perdidas se
// o código for gerado novamente.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: System.Data.Mapping.EntityViewGenerationAttribute(typeof(Edm_EntityMappingGeneratedViews.ViewsForBaseEntitySets7F3AFE99A19115C1600A2D3407EFC3D1F36FBA78AF0470677E19E4A993E04F7B))]
namespace Edm_EntityMappingGeneratedViews
{
/// <Summary>
/// O tipo contém exibições para EntitySets e AssociationSets que foram gerados em tempo de design.
/// </Summary>
public sealed class ViewsForBaseEntitySets7F3AFE99A19115C1600A2D3407EFC3D1F36FBA78AF0470677E19E4A993E04F7B : System.Data.Mapping.EntityViewContainer
{
/// <Summary>
/// O construtor armazena as exibições para as extensões e também os valores de hash gerados com base nos metadados e no fechamento e nas exibições do mapeamento.
/// </Summary>
public ViewsForBaseEntitySets7F3AFE99A19115C1600A2D3407EFC3D1F36FBA78AF0470677E19E4A993E04F7B()
{
this.EdmEntityContainerName = "Context";
this.StoreEntityContainerName = "CodeFirstDatabase";
this.HashOverMappingClosure = "edf2b152bf40e88b95f3411ab7b29fa2627c7224d571c8d9557eef38c0f29386";
this.HashOverAllExtentViews = "10a3551ac384c60e8d31d44333d96794897a405b3f595947069bdd8f21e80060";
this.ViewCount = 16;
}
/// <Summary>
/// O método retorna a exibição do índice fornecido.
/// </Summary>
protected override System.Collections.Generic.KeyValuePair<string, string> GetViewAt(int index)
{
if ((index == 0))
{
return GetView0();
}
if ((index == 1))
{
return GetView1();
}
if ((index == 2))
{
return GetView2();
}
if ((index == 3))
{
return GetView3();
}
if ((index == 4))
{
return GetView4();
}
if ((index == 5))
{
return GetView5();
}
if ((index == 6))
{
return GetView6();
}
if ((index == 7))
{
return GetView7();
}
if ((index == 8))
{
return GetView8();
}
if ((index == 9))
{
return GetView9();
}
if ((index == 10))
{
return GetView10();
}
if ((index == 11))
{
return GetView11();
}
if ((index == 12))
{
return GetView12();
}
if ((index == 13))
{
return GetView13();
}
if ((index == 14))
{
return GetView14();
}
if ((index == 15))
{
return GetView15();
}
throw new System.IndexOutOfRangeException();
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.Invoice
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView0()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Invoice", @"
SELECT VALUE -- Constructing Invoice
[CodeFirstDatabaseSchema.Invoice](T1.Invoice_Id, T1.Invoice_Code, T1.Invoice_Date, T1.Invoice_Value, T1.Invoice_Discount)
FROM (
SELECT
T.Id AS Invoice_Id,
T.Code AS Invoice_Code,
T.Date AS Invoice_Date,
T.[Value] AS Invoice_Value,
T.Discount AS Invoice_Discount,
True AS _from0
FROM Context.Invoices AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.Voucher
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView1()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Voucher", @"
SELECT VALUE -- Constructing Voucher
[CodeFirstDatabaseSchema.Voucher](T1.Voucher_Id, T1.Voucher_Code, T1.Voucher_Purpose, T1.Voucher_Date, T1.Voucher_Value, T1.Voucher_AdjustedValue, T1.Voucher_Status, T1.Voucher_Note, T1.[Voucher.Employee_Id], T1.[Voucher.Request_Id], T1.[Voucher.Unit_Id], T1.[Voucher.ResultCenter_Id], T1.[Voucher.Invoice_Id])
FROM (
SELECT
T.Id AS Voucher_Id,
T.Code AS Voucher_Code,
T.Purpose AS Voucher_Purpose,
T.Date AS Voucher_Date,
T.[Value] AS Voucher_Value,
T.AdjustedValue AS Voucher_AdjustedValue,
T.Status AS Voucher_Status,
T.Note AS Voucher_Note,
T.Employee_Id AS [Voucher.Employee_Id],
T.Request_Id AS [Voucher.Request_Id],
T.Unit_Id AS [Voucher.Unit_Id],
T.ResultCenter_Id AS [Voucher.ResultCenter_Id],
T.Invoice_Id AS [Voucher.Invoice_Id],
True AS _from0
FROM Context.Vouchers AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.Employee
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView2()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Employee", @"
SELECT VALUE -- Constructing Employee
[CodeFirstDatabaseSchema.Employee](T1.Employee_Id, T1.Employee_Name, T1.Employee_Active)
FROM (
SELECT
T.Id AS Employee_Id,
T.Name AS Employee_Name,
T.Active AS Employee_Active,
True AS _from0
FROM Context.Employees AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.Request
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView3()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Request", @"
SELECT VALUE -- Constructing Request
[CodeFirstDatabaseSchema.Request](T1.Request_Id, T1.Request_Date, T1.Request_Justification, T1.Request_Note, T1.Request_Processed, T1.[Request.Employee_Id])
FROM (
SELECT
T.Id AS Request_Id,
T.Date AS Request_Date,
T.Justification AS Request_Justification,
T.Note AS Request_Note,
T.Processed AS Request_Processed,
T.Employee_Id AS [Request.Employee_Id],
True AS _from0
FROM Context.Requests AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.RequestHistory
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView4()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.RequestHistory", @"
SELECT VALUE -- Constructing RequestHistory
[CodeFirstDatabaseSchema.RequestHistory](T1.RequestHistory_Id, T1.RequestHistory_Date, T1.[RequestHistory.Request_Id], T1.[RequestHistory.Item_Id], T1.[RequestHistory.Employee_Id], T1.[RequestHistory.Unit_Id], T1.[RequestHistory.ResultCenter_Id])
FROM (
SELECT
T.Id AS RequestHistory_Id,
T.Date AS RequestHistory_Date,
T.Request_Id AS [RequestHistory.Request_Id],
T.Item_Id AS [RequestHistory.Item_Id],
T.Employee_Id AS [RequestHistory.Employee_Id],
T.Unit_Id AS [RequestHistory.Unit_Id],
T.ResultCenter_Id AS [RequestHistory.ResultCenter_Id],
True AS _from0
FROM Context.RequestHistories AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.Unit
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView5()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.Unit", @"
SELECT VALUE -- Constructing Unit
[CodeFirstDatabaseSchema.Unit](T1.Unit_Id, T1.Unit_Code, T1.Unit_Name, T1.Unit_Manager, T1.Unit_Description, T1.Unit_Year, T1.Unit_Level, T1.Unit_Type, T1.[Unit.Parent_Id])
FROM (
SELECT
T.Id AS Unit_Id,
T.Code AS Unit_Code,
T.Name AS Unit_Name,
T.Manager AS Unit_Manager,
T.Description AS Unit_Description,
T.Year AS Unit_Year,
T.Level AS Unit_Level,
T.Type AS Unit_Type,
T.Parent_Id AS [Unit.Parent_Id],
True AS _from0
FROM Context.Units AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.ResultCenter
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView6()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.ResultCenter", @"
SELECT VALUE -- Constructing ResultCenter
[CodeFirstDatabaseSchema.ResultCenter](T1.ResultCenter_Id, T1.ResultCenter_Code, T1.ResultCenter_Name, T1.ResultCenter_Description, T1.ResultCenter_Year, T1.ResultCenter_Level, T1.ResultCenter_Type, T1.ResultCenter_Usage, T1.ResultCenter_StartDate, T1.ResultCenter_ExpirationDate, T1.ResultCenter_Active, T1.[ResultCenter.Parent_Id], T1.[ResultCenter.Unit_Id])
FROM (
SELECT
T.Id AS ResultCenter_Id,
T.Code AS ResultCenter_Code,
T.Name AS ResultCenter_Name,
T.Description AS ResultCenter_Description,
T.Year AS ResultCenter_Year,
T.Level AS ResultCenter_Level,
T.Type AS ResultCenter_Type,
T.Usage AS ResultCenter_Usage,
T.StartDate AS ResultCenter_StartDate,
T.ExpirationDate AS ResultCenter_ExpirationDate,
T.Active AS ResultCenter_Active,
T.Parent_Id AS [ResultCenter.Parent_Id],
T.Unit_Id AS [ResultCenter.Unit_Id],
True AS _from0
FROM Context.ResultCenters AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para CodeFirstDatabase.RequestItem
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView7()
{
return new System.Collections.Generic.KeyValuePair<string, string>("CodeFirstDatabase.RequestItem", @"
SELECT VALUE -- Constructing RequestItem
[CodeFirstDatabaseSchema.RequestItem](T1.RequestItem_Id, T1.RequestItem_Date, T1.RequestItem_Data_Retorno, T1.RequestItem_Quantity, T1.[RequestItem.Employee_Id], T1.[RequestItem.Unit_Id], T1.[RequestItem.ResultCenter_Id], T1.[RequestItem.TaxiRequest_Id])
FROM (
SELECT
T.Id AS RequestItem_Id,
T.Date AS RequestItem_Date,
T.Data_Retorno AS RequestItem_Data_Retorno,
T.Quantity AS RequestItem_Quantity,
T.Employee_Id AS [RequestItem.Employee_Id],
T.Unit_Id AS [RequestItem.Unit_Id],
T.ResultCenter_Id AS [RequestItem.ResultCenter_Id],
T.TaxiRequest_Id AS [RequestItem.TaxiRequest_Id],
True AS _from0
FROM Context.RequestItems AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.Invoices
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView8()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.Invoices", @"
SELECT VALUE -- Constructing Invoices
[GAWeb.VoucherRequests.Model.DAL.Invoice](T1.Invoice_Id, T1.Invoice_Code, T1.Invoice_Date, T1.Invoice_Value, T1.Invoice_Discount)
FROM (
SELECT
T.Id AS Invoice_Id,
T.Code AS Invoice_Code,
T.Date AS Invoice_Date,
T.[Value] AS Invoice_Value,
T.Discount AS Invoice_Discount,
True AS _from0
FROM CodeFirstDatabase.Invoice AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.Vouchers
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView9()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.Vouchers", @"
SELECT VALUE -- Constructing Vouchers
[GAWeb.VoucherRequests.Model.DAL.Voucher](T1.Voucher_Id, T1.Voucher_Code, T1.Voucher_Purpose, T1.Voucher_Date, T1.Voucher_Value, T1.Voucher_AdjustedValue, T1.Voucher_Status, T1.Voucher_Note, T1.[Voucher.Employee_Id], T1.[Voucher.Request_Id], T1.[Voucher.Unit_Id], T1.[Voucher.ResultCenter_Id], T1.[Voucher.Invoice_Id])
FROM (
SELECT
T.Id AS Voucher_Id,
T.Code AS Voucher_Code,
T.Purpose AS Voucher_Purpose,
T.Date AS Voucher_Date,
T.[Value] AS Voucher_Value,
T.AdjustedValue AS Voucher_AdjustedValue,
T.Status AS Voucher_Status,
T.Note AS Voucher_Note,
T.Employee_Id AS [Voucher.Employee_Id],
T.Request_Id AS [Voucher.Request_Id],
T.Unit_Id AS [Voucher.Unit_Id],
T.ResultCenter_Id AS [Voucher.ResultCenter_Id],
T.Invoice_Id AS [Voucher.Invoice_Id],
True AS _from0
FROM CodeFirstDatabase.Voucher AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.Employees
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView10()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.Employees", @"
SELECT VALUE -- Constructing Employees
[GAWeb.VoucherRequests.Model.DAL.Employee](T1.Employee_Id, T1.Employee_Name, T1.Employee_Active)
FROM (
SELECT
T.Id AS Employee_Id,
T.Name AS Employee_Name,
T.Active AS Employee_Active,
True AS _from0
FROM CodeFirstDatabase.Employee AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.Requests
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView11()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.Requests", @"
SELECT VALUE -- Constructing Requests
[GAWeb.VoucherRequests.Model.DAL.Request](T1.Request_Id, T1.Request_Date, T1.Request_Justification, T1.Request_Note, T1.Request_Processed, T1.[Request.Employee_Id])
FROM (
SELECT
T.Id AS Request_Id,
T.Date AS Request_Date,
T.Justification AS Request_Justification,
T.Note AS Request_Note,
T.Processed AS Request_Processed,
T.Employee_Id AS [Request.Employee_Id],
True AS _from0
FROM CodeFirstDatabase.Request AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.RequestHistories
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView12()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.RequestHistories", @"
SELECT VALUE -- Constructing RequestHistories
[GAWeb.VoucherRequests.Model.DAL.RequestHistory](T1.RequestHistory_Id, T1.RequestHistory_Date, T1.[RequestHistory.Request_Id], T1.[RequestHistory.Item_Id], T1.[RequestHistory.Employee_Id], T1.[RequestHistory.Unit_Id], T1.[RequestHistory.ResultCenter_Id])
FROM (
SELECT
T.Id AS RequestHistory_Id,
T.Date AS RequestHistory_Date,
T.Request_Id AS [RequestHistory.Request_Id],
T.Item_Id AS [RequestHistory.Item_Id],
T.Employee_Id AS [RequestHistory.Employee_Id],
T.Unit_Id AS [RequestHistory.Unit_Id],
T.ResultCenter_Id AS [RequestHistory.ResultCenter_Id],
True AS _from0
FROM CodeFirstDatabase.RequestHistory AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.Units
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView13()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.Units", @"
SELECT VALUE -- Constructing Units
[GAWeb.VoucherRequests.Model.DAL.Unit](T1.Unit_Id, T1.Unit_Code, T1.Unit_Name, T1.Unit_Manager, T1.Unit_Description, T1.Unit_Year, T1.Unit_Level, T1.Unit_Type, T1.[Unit.Parent_Id])
FROM (
SELECT
T.Id AS Unit_Id,
T.Code AS Unit_Code,
T.Name AS Unit_Name,
T.Manager AS Unit_Manager,
T.Description AS Unit_Description,
T.Year AS Unit_Year,
T.Level AS Unit_Level,
T.Type AS Unit_Type,
T.Parent_Id AS [Unit.Parent_Id],
True AS _from0
FROM CodeFirstDatabase.Unit AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.ResultCenters
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView14()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.ResultCenters", @"
SELECT VALUE -- Constructing ResultCenters
[GAWeb.VoucherRequests.Model.DAL.ResultCenter](T1.ResultCenter_Id, T1.ResultCenter_Code, T1.ResultCenter_Name, T1.ResultCenter_Description, T1.ResultCenter_Year, T1.ResultCenter_Level, T1.ResultCenter_Type, T1.ResultCenter_Usage, T1.ResultCenter_StartDate, T1.ResultCenter_ExpirationDate, T1.ResultCenter_Active, T1.[ResultCenter.Parent_Id], T1.[ResultCenter.Unit_Id])
FROM (
SELECT
T.Id AS ResultCenter_Id,
T.Code AS ResultCenter_Code,
T.Name AS ResultCenter_Name,
T.Description AS ResultCenter_Description,
T.Year AS ResultCenter_Year,
T.Level AS ResultCenter_Level,
T.Type AS ResultCenter_Type,
T.Usage AS ResultCenter_Usage,
T.StartDate AS ResultCenter_StartDate,
T.ExpirationDate AS ResultCenter_ExpirationDate,
T.Active AS ResultCenter_Active,
T.Parent_Id AS [ResultCenter.Parent_Id],
T.Unit_Id AS [ResultCenter.Unit_Id],
True AS _from0
FROM CodeFirstDatabase.ResultCenter AS T
) AS T1");
}
/// <Summary>
/// exibição de retorno para Context.RequestItems
/// </Summary>
private System.Collections.Generic.KeyValuePair<string, string> GetView15()
{
return new System.Collections.Generic.KeyValuePair<string, string>("Context.RequestItems", @"
SELECT VALUE -- Constructing RequestItems
[GAWeb.VoucherRequests.Model.DAL.RequestItem](T1.RequestItem_Id, T1.RequestItem_Date, T1.RequestItem_Data_Retorno,T1.RequestItem_Quantity, T1.[RequestItem.Employee_Id], T1.[RequestItem.Unit_Id], T1.[RequestItem.ResultCenter_Id], T1.[RequestItem.TaxiRequest_Id])
FROM (
SELECT
T.Id AS RequestItem_Id,
T.Date AS RequestItem_Date,
T.Data_Retorno AS RequestItem_Data_Retorno,
T.Quantity AS RequestItem_Quantity,
T.Employee_Id AS [RequestItem.Employee_Id],
T.Unit_Id AS [RequestItem.Unit_Id],
T.ResultCenter_Id AS [RequestItem.ResultCenter_Id],
T.TaxiRequest_Id AS [RequestItem.TaxiRequest_Id],
True AS _from0
FROM CodeFirstDatabase.RequestItem AS T
) AS T1");
}
}
}
Missed you say like that
UnitOfWork
is instantiated and as theIEntities
are filled.– Leonel Sanches da Silva
@Ciganomorrisonmendez Pronto
– PFVictor
I also need the class code
Context
. Can you please ask the question?– Leonel Sanches da Silva
I posted @Ciganomorrisonmendez
– PFVictor
There is only this Dbset?
public DbSet<Invoice> Invoices { get; set; }
. I’m updating the response.– Leonel Sanches da Silva
Yes, I added the question to another class that has reference to dbSet
– PFVictor