I am getting the error:
ORA-00942: table or view does not exist Telerik.OpenAccess.RT.sql.SQLException: ORA-00942: table or view does not exist ---> Oracle.DataAccess.Client.OracleException: ORA-00942: table or view does not exist
I have a Fund table which has a one to many relationship with a FundRecord table:
My Fund poco object is like:
public class Fund
{
public Fund()
{
FundRecords = new List<FundRecord>();
}
public int Id { get; set; }
public int FundManagerId { get; set; }
public string Name { get; set; }
public DateTime CreatedOn { get; set; }
public string CreatedBy { get; set; }
public IList<FundRecord> FundRecords { get; set; }
}
And my Fund Record:
public class FundRecord
{
public int Id { get; set; }
public int FundId { get; set; }
public decimal MaxExposure { get; set; }
public int Tier { get; set; }
public int SupplierRisk { get; set; }
public decimal SupplierFlowExposure { get; set; }
public decimal MaxSupplierExposure { get; set; }
public decimal IndividualSupplierExposure { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public bool IsCurrent { get; set; }
public string CreatedBy { get; set; }
public Fund Fund { get; set; }
}
I am mapping using:
protected override IList<MappingConfiguration> PrepareMapping()
{
List<MappingConfiguration> configurations = new List<MappingConfiguration>();
var fundMapping = new MappingConfiguration<Fund>();
fundMapping.MapType(fund => new
{
Id = fund.Id,
FundManagerId = fund.FundManagerId,
Name = fund.Name,
CreatedOn = fund.CreatedOn,
CreatedBy = fund.CreatedBy,
}).ToTable("FUND");
fundMapping.HasProperty(c => c.Id).IsIdentity();
var fundRecordMapping = new MappingConfiguration<FundRecord>();
fundRecordMapping.MapType(fundRecord => new
{
Id = fundRecord.Id,
FundId = fundRecord.FundId,
MaxExposure = fundRecord.MaxExposure,
Tier = fundRecord.Tier,
SupplierRisk = fundRecord.SupplierRisk,
SupplierFlowExposure = fundRecord.SupplierFlowExposure,
MaxSupplierExposure = fundRecord.MaxSupplierExposure,
IndividualSupplierExposure = fundRecord.IndividualSupplierExposure,
StartDate = fundRecord.StartDate,
EndDate = fundRecord.EndDate,
IsCurrent = fundRecord.IsCurrent,
CreatedBy = fundRecord.CreatedBy,
}).ToTable("FUNDRECORD");
fundMapping.HasProperty(c => c.Id).IsIdentity();
fundMapping.HasAssociation(x => x.FundRecords).WithOpposite(y => y.Fund).HasConstraint((x, y) => x.Id == y.FundId);
configurations.Add(fundMapping);
configurations.Add(fundRecordMapping);
return configurations;
}
The FluentModel is:
public class FluentModel : OpenAccessContext
{
private static readonly string connectionStringName = @"Connection";
private static readonly BackendConfiguration backend = GetBackendConfiguration();
private static readonly MetadataSource metadataSource = new FluentModelMetadataSource();
public FluentModel()
: base(connectionStringName, backend, metadataSource)
{
}
// ERRORS HERE
public IQueryable<Fund> Funds
{
get { return GetAll<Fund>(); }
}
public IQueryable<FundRecord> FundRecords
{
get { return GetAll<FundRecord>(); }
}
protected override void OnDatabaseOpen(BackendConfiguration backendConfiguration, MetadataContainer metadataContainer)
{
metadataContainer.DefaultMapping.InheritanceStrategy = InheritanceStrategy.Horizontal;
metadataContainer.DefaultMapping.UseDelimitedSQL = false;
base.OnDatabaseOpen(backendConfiguration, metadataContainer);
}
public static BackendConfiguration GetBackendConfiguration()
{
var backend = new BackendConfiguration();
backend.Backend = "Oracle";
backend.ProviderName = "Oracle.ManagedDataAccess.Client";
backend.ConnectionPool.InitSQL.Add("ALTER SESSION SET CURRENT_SCHEMA=GENESIS_ALLOCATION");
return backend;
}
I am not sure why I am getting this issue so any help would be very helpful.
Many thanks