Click here to Skip to main content
14,422,439 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
We are using Nhibernet MVC Artecture Code first approach in C# Asp.Net with Web API's,SQL Server as Backend Database System.
My Current Server Configuration is Windows Server 2016 with 16GB Ram 4Core processor and Hosted it on Microsoft Azure.

Following issue getting randomly :


Exception Occured at Client/Dashboard
Exception is 'could not load an entity: [LegalNext.Model.ClientType#1]
[SQL: SELECT clienttype0_.Id as Id24_0_, clienttype0_.Name as Name24_0_, clienttype0_.Description as Descript3_24_0_, clienttype0_.IsActive as IsActive24_0_ FROM [ClientType] clienttype0_ WHERE clienttype0_.Id=?]'

What I have tried:

uow.Open();

long ClienTypeId = 0;
var clientMatrixRepository = Container.Resolve<model.orm.repository<int, clientmatrix="">>();

var ClientMatrixDBEntities = clientMatrixRepository.GetMany(c => c.IsActive == true && c.Client !=null && c.Client.Id == ClientId).FirstOrDefault();
if (ClientMatrixDBEntities == null)
return ClienTypeId;

var config = new MapperConfiguration(con => con.CreateMap<clientmatrix, clientmatrixentity="">());
IMapper mapper = config.CreateMapper();
var ClientMatrixEntities = mapper.Map<clientmatrix, clientmatrixentity="">(ClientMatrixDBEntities);
if (ClientMatrixEntities == null)
throw new ApplicationException("Mapping error");

ClienTypeId = Convert.ToInt64(ClientMatrixEntities.ClientType.Id);
uow.Close();
return ClienTypeId;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100