I'm trying to save user code scripts in RavenDB, and so far almost everything works. I got a script in from a separate process, and I am able to load the script, edit it, and save it back to the database.
The problem comes when I create a new script and try to insert it into the database. I use the code below.
public static void AddUserScript(UserScripts entity, string RavendbUrl, int userid)
{
try
{
IvcRavenDB raven = new IvcRavenDB();
var store = raven.InitRavenDB(RavendbUrl, "UserScripts");
entity.Updated = DateTime.Now.ToString();
entity.Created = DateTime.Now.ToString();
entity.ScriptFileLength = entity.Script.Length;
entity.userid = userid;
using (var session = store.OpenSession())
{
session.Store(entity); // DIES HERE
session.SaveChanges();
}
}
catch (Exception ex)
{
var mess = ex.Message;
}
}
When I say dies, the next line is not executed, there is no exception, and I see no error anywhere, which is very odd. Almost the EXACT same code works to save an entity with an Id, the only difference is that the Id field when adding is null.
I'm using RavenDB 4 with Raven Client 4.02 in ,Net Core 2.0.
I'm very new to Raven and don't even know where to start to figure this out without errors, so any help would be great.