I have a WCF Service with a static data context, but no concurrency. It has been live for a year with no issues, but we saw some strange behavior the other day where users were passing data in correctly, but getting unexpected and incorrect data back. This does pass through an F5, so we're looking at issues there as well.
Would there be any negative impacts to having Single Concurrency Per Session as set-up below with a Static Context?
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.PerSession)]
public class AgencyUserManagementService : IAgencyUserManagement, IDisposable
{
private static UserDataContext _dataContext;
protected static UserDataContext Db
{
get { return _dataContext ?? (_dataContext = new UserDataContext()); }
}
}
public class UserDataContext : DbContext
{
public UserDataContext()
: base("Name=UserDataContext")
{
Database.SetInitializer<UserDataContext>(null);
}
public DbSet<TblAuthor> TblAuthors { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new TblAuthorMap());
}
}