jaduff / LabLog

Software for recording physical users of computers in a lab environment.
MIT License
0 stars 1 forks source link

Admin create room generates an event that is stored in the database #14

Closed jaduff closed 7 years ago

jaduff commented 7 years ago

I've added a constructor to the controller to accept EventModelContext, but don't know how/where to inject from?

jaduff commented 7 years ago

Hmm, seems to be magical? https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/dependency-injection

jaduff commented 7 years ago

An unhandled exception has occurred: Unable to resolve service for type 'LabLog.EventModelContext' while attempting to activate 'LabLog.Controllers.AdminController'. System.InvalidOperationException: Unable to resolve service for type 'LabLog.EventModelContext' while attempting to activate 'LabLog.Controllers.AdminController'.

simonjduff commented 7 years ago

It's not magic, you register the dependencies in ConfigureServices in startup.cs. See here for an example: https://github.com/simonjduff/DdhpCore/blob/master/src/DdhpCore.FrontEnd/Startup.cs

jaduff commented 7 years ago

Microsoft.Data.Sqlite.SqliteException: SQLite Error 19: 'UNIQUE con straint failed: LabEvents.Version'. I can't see how/where the version is set.

simonjduff commented 7 years ago

Check VersionTests.cs to see how version works

jaduff commented 7 years ago

Have all the issues been sorted? Should I merge this now?