[DevExpress Support Team: CLONED FROM Q439032: How do I map persistent classes to another schema, e.g. other than the default "dbo" in MS SQL Server?]
Hello,
I tried both options to map my persistent classes to a non-default schema as attached. But, when I login the system, it still go to select dbo.PermissionPolicyUser. Do I missing something?
Thanks,
Gary
Hello, Gary.
The information you provided is insufficient to diagnose the issue. Please provide us with the full call stack of the exception (see Collect and Analyze the Diagnostic Information) or a small sample project demonstrating the issue.
Hello Michael,
Attached please find my sample project. I just follow the instruction in Q439032 to update WebApplication.cs.
Maybe I need more coding? Could you please point me to the right direction?
Thank you very much!
Best Regards,
Gary
Hi Gary,
Thank you for your project. I reproduced the issue using it. I see that our Security System creates an MSSqlConnectionProvider instance for which the DataStoreCreated event is not raised. We will check if this is expected behavior.
At the moment, I suggest you specify the data table scheme by using the Persistent attribute. You can assign it in the CustomizeTypesInfo method as described in the How to separate database tables from built-in system tables via a prefix or custom schema article. The code will be as follows:
public override void CustomizeTypesInfo(ITypesInfo typesInfo) { base.CustomizeTypesInfo(typesInfo); CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo); XPDictionary dictionary = XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary; dictionary.GetClassInfo(typeof(DevExpress.ExpressApp.Xpo.Updating.ModuleInfo)); dictionary.GetClassInfo(typeof(DevExpress.Xpo.XPObjectType)); dictionary.GetClassInfo(typeof(DevExpress.Xpo.XPWeakReference)); foreach (XPClassInfo ci in dictionary.Classes) { if (ci.IsPersistent) { ci.RemoveAttribute(typeof(PersistentAttribute)); ci.AddAttribute(new PersistentAttribute(string.Format("xaf.{0}", ci.TableName))); typesInfo.RefreshInfo(ci.ClassType); } } }
Hi Gosha,
Yes, it works. This is the best option, right?! or Would there any trouble during version upgrade, etc ?
Many Thanks,
Gary