The problem is that my MVC app is connecting well to my database but when I query it it doesn't return anything(var model
is empty
) and I don't know what's the problem.I'm using SharpLite
template so this already has automappings implemented and is connecting to my database using NHibernate
, I already implemented the User
entity in MyProject.Domain
.
Here is the code in my User Controller
:
private readonly IRepository<User> _repository;
public UserController(IRepository<User> repository)
{
_repository = repository;
}
public ActionResult Index()
{
var model = _repository.GetAll();
return View(model);
}
And this is the code from NHibernate initializer
:
public static Configuration Initialize()
{
var configuration = new Configuration();
configuration
.Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
.DataBaseIntegration(db => {
db.ConnectionStringName = "MyProjectConnectionString";
db.Dialect<PostgreSQL82Dialect>();
})
.AddAssembly(typeof(ActionConfirmation<>).Assembly)
.CurrentSessionContext<LazySessionContext>();
var mapper = new ConventionModelMapper();
mapper.WithConventions(configuration);
return configuration;
}