Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 tool using Entity Framework caching issues with Ninject
    primarykey
    data
    text
    <p>I've got a new MVC 3 application which is showing some issues when modifying data manually in the Database.</p> <p>The tool is still in development and once in a while I want to change my user's teamId. When I do so, I have to kill the Web development Server and run it again otherwise the queries don't pick the new teamId. Same thing when I publish the tool to IIS, if I ever modify something on the database, I need to either copy over the 'bin' folder again or stop the application and re-run it.</p> <p>When I modify data from the application itself, I have no problems.</p> <p>This is how my Ninject looks like:</p> <pre><code>public class NinjectControllerFactory : DefaultControllerFactory { private IKernel kernel = new StandardKernel(new TrackerServices()); protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { if (controllerType == null) return null; return (IController)kernel.Get(controllerType); } private class TrackerServices : NinjectModule { public override void Load() { var context = new TrackerEntities(); Bind&lt;IUserRepository&gt;().To&lt;UserRepository&gt;().WithConstructorArgument("context", context); } } } </code></pre> <p>My Interface:</p> <pre><code>public interface IUserRepository : IRepository&lt;User&gt; { User GetByName(string name); } </code></pre> <p>my Implementation:</p> <pre><code>public User GetByName(string login) { var userLogin = _misc.GetUsername(login); return _context.Users.Where(x =&gt; x.Login == userLogin).Single(); } </code></pre> <p>And my Index Action</p> <pre><code>public ActionResult Index() { var teamid = (int)_users.GetByName("myName").TeamId; </code></pre> <p>This has never happened before, but this tool is the first one I'm using with Ninject. I'm wondering if there's a relation between my problem and using a repository?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload