Question

Photo of Nick Brown

0

SDK initial setup issue

I'm trying to get the SDK running and the project builds fine, my db connection is set with a user that has dbcreater access.

When I run the project it gives a null exception error when calling the LoadCacheObjects method on the global startup on this line:

var definedValue in new Rock.Model.DefinedValueService( rockContext ).GetByDefinedTypeGuid( Rock.SystemGuid.DefinedType.LOCATION_COUNTRIES.AsGuid() ).AsNoTracking()


rockContext has a value and the location_countries.asguid returns a value when I do a quick watch on it


I'm running this on Visual Studio 2017 and it's the latest SDK I just downloaded from the RockRMS site a few days ago.


Anyone have any ideas on how I can get this running?


Thanks,

Nick

  • Photo of Nick Airdo

    0

    Hi Nick,

    It sounds like the Rock web application can't see the database.  Here are a few things to check:

    1. Is there a Run.Migration file sitting under your App_Data folder?  If so, it would indicate Rock did not (or could not) finish setting up the database and/or data migration.
    2. Are you getting this error when you press F5 in Visual Studio (assuming RockWeb is the StartUp project)
    3. In Visual Studio, open up the Package Manager Console -- and ensuring you have "Rock.Migrations" selected as the Default project (see this picture; not to be confused with the previous item)  -- then run "Update-Database" from that package manager console.   Do you get any errors?  [EDIT: On second thought, scratch this step.  The Rockit SDK doesn't come with a separate project for the Rock Migrations -- so it requires migrations be triggered via the Run.Migration flag file described in step 1]
    4. If you have SQL Studio Manager installed, can you run this and let us know what number it reports back:
    SELECT COUNT(1) FROM __MigrationHistory
  • Photo of Nick Brown

    0

    Thanks for those tips, I found I was missing the Rock.Migrations file from my project so I think the first time I ran it I named the db catalog of something that already existed, I started over and changed the name of the db catalog and then it setup the db and got everything running successfully.