Firstly let me apologise as I don't believe it is a CSLA issue but an EF6 one.
I am using CSLA 4.5, EF6 and WCF with IIS Express in VS2012.
My problem is whenever I add a record in a dataportal_insert EF6 clears the user security so when the response goes back to the client the o:security section of the message is missing which can be seen using svctraceviewer.exe in all prior messages.
if I comment out the add and savechanges lines all works.
public void Insert(ProductData productData)
{
using (var ctx = DbContextManager<DatabaseContext>.GetManager())
{
ctx.DbContext.Products.Add(new Product().InjectFrom(productData) as Product);
ctx.DbContext.SaveChanges();
}
}
I had originally thought it was my web.config settings but after trying countless configs and getting the same results I am now at a loss. It's Friday and I have spent the last 4 days trying to figure it out and am scared of facing this problem again come Monday.
Any guidance would severely be appreciated.
An update to let anyone else who has this problem in the future the solution (nobody will ever have this problem i'm sure !)
It turned out to be due to
System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath)
which I was using to get a create a new log file for a trace listener defined in my system.diagnostics section of the web config and without looking I guess doing the reflection thing does something with the current principal.
Changed to
AppDomain.CurrentDomain.BaseDirectory
And all fixed
I haven't got unit tests set up (I know, shame on me) but I don't believe any would have found this problem as it only manifested when loading the assembly via ASP.NET.
Copyright (c) Marimer LLC