Upload
tas-pro
View
2
Download
0
Embed Size (px)
DESCRIPTION
a
Citation preview
Tags: .NET, Frameworks (XAF & XPO), eXpressApp FrameworkID :Q403538
Created O n :5/23/2012 7:47:13 PM
Mod if ied O n :5/24/2012 6:09:03 PM
B u ild :v2010 vo l 2.8 / 25-Apr-2011
Related Questions
XPO b jecttype data co rru p tion ?
Cu stomizeTypeIn fo from a n on XafApp lication
W orkf low Server M issin g Sto reIn stan ce
Th e ALTER TAB LE statemen tcon flicted w ith th e FO REIG N KEYcon stra in t . . .
Ro le class ch an ge
SUPPORT CENTER FAQTraining EventsLocalizationExamplesTickets
Submit a Support TicketSubmit a Support TicketType search string and press Enter
1solution
Provide some method to really update XPObjectTypes
0 Marco 4 years ago
H i,
In our application, we had the following situation:
Classname: "Event", Tablename "InfEvent"
This class also had a baseclass (EventBase) and as such, it's XPObjectType.Oid was used in the EventBase.ObjectType column.
We needed to replace the Event class by a new Event class. The old 'Events' needed to be converted to new 'Events' and as such, the old one was renamedto InfEvent (to line it up with the name of the database table).
As we knew, we had to update the XPObjectType manually but during conversion of the 'InfEvent' objects to the new 'Event' class, it appeared that XPOtried to load InfEvent objects from the Event table (which was still empty).
After long investigation, it appears that XPO uses 2 caches for the XPObjectTypes. One of them is in the XPObjectTypesManager (_allTypes) the other one inBaseDataLayer.StaticData.
Changing the XPObjectType record in the database does not reload these caches, so we looked at
a way to do that manually.
The XPObjectTypesManager cache can be reset by calling a DropIdentityMap.
The Static Data dictionary in BaseDataLayer however, can only be cleared by calling ClearStaticData. This method is protected and the only calling methodis ClearDatabase, something we definitely do not want.
So, in fact there is no normal way to clear this cache without clearing the database.
IMHO, when XPO notices a change in an XPObjectType object, it should have an ability to refresh it's
cache of XPObjects as well, or refresh it automatically.
Thanks,Marco
P.S. As a workaround, we now call ClearStaticData by using reflection, but of course this is not a good solution.
Leave a Comment
1 Solution
0 Michael (DevExpress Support) 4 years ago
Hi Marco,
Thank you for the question. Your scenario is quite unusual and I am afraid we won't publish this internal method. Instead of clering this dictionary or clearingthe dataabse, I recommend that you create a new data layer after your type manipulations.
>>>IMHO, when XPO notices a change in an XPObjectType object, it should have an ability to refresh it'scache of XPObjects as well, or refresh it automatically.
The XPObjectType class is defined as session-less and does not support change notifications. We have not considered such scenarios when designing theXPO Library.
Hi M ich ael,
Allth ou gh i d id n o t con sider th is so lu tion , it is n o t a so lu tion in ou r scen ario . W e u se XPO w ith in XAF an d at th e po in t w e u pdate th eXPO b jectType tab le, th e cu rren t DataLayer may be u sed a lready in severa l o th er Session s / O b jectSpaces.So recreatin g th e DataLayer is n o t a so lu tion .
An yw ay, th an ks fo r you r in terest.
Marco 4 years ago
Th an k you fo r men tion in g XAF . I su ggest th at you refer to th e How to : U pdate th e Database Stru ctu re after th e Persisten t Class o r PropertyW as Ren amed o r Removed article w h ere similar tasks w ere d iscu ssed .
Specif ica lly, you can u se th e Modu leU pdater.U pdateXPO b jectType meth od to u pdate th is tab le. U n fo rtu n ately, it on ly u pdates th e database,an d you n eed to man u ally reload ch an ged XPO b jectType in stan ces. You can do th is as fo llow s:
Michael (DevExpress Support) 4 years ago
Products Free Trials & Demos Buy Support My Account About Us
Log In
Q403538 - Provide some method to really update XPObjectTypes | DevExpress Support Center 25-May-15
https://www.devexpress.com/Support/Center/Question/Details/Q403538 1 / 2
DEVEXPRESSAbout UsNewsOur AwardsUpcoming EventsUser CommentsCase StudiesReviews and PublicationsLicensingPurchasingMVP ProgramContact UsLogos
.NET CONTROLSWinFormsASP.NETMVCWPFSilverlightWindows 8 XAML
CROSS PLATFORMReportingDocument Automation
MOBILEDevExtreme Mobile
ENTERPRISE TOOLSReport ServerAnalytics Dashboard
FRAMEWORKSeXpressApp Framework
CODE-DEBUG-REFACTORCodeRush for Visual Studio
HTML5 JS WIDGETSDevExtreme Web
iOS 7DataExplorer
FUNCTIONAL WEB TESTINGTestCafe
DELPHI C++BUILDERVCL
SUPPORTSearch the Knowledge BaseMy QuestionsCode ExamplesGetting StartedDemosDocumentationBlogsTrainingWebinars
Current Version/BuildVersion History
FOLLOW US
Your Privacy - Legal Statements Copyright 1998-2014 Developer Express Inc.All trademarks or registered trademarks are property of their respective owners
DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, BusinessApplication Frameworks, and Reporting Systems for Visual Studio, along with high-performanceHTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whetherusing WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help youbuild and deliver your best in the shortest time possible.
public override void UpdateDatabaseAfterUpdateSchema() { base.UpdateDatabaseAfterUpdateSchema(); ... _session = ((ObjectSpace)ObjectSpace).Session; _session.CreateObjectTypeRecords(GetAssemblies()); var types = _session.TypesManager.AllTypes; foreach (var xpObjectType in types) { if (!xpObjectType.Value.IsValidType) { _session.Reload(xpObjectType.Value); } } ... }
W e w ill mod ify th e U pdateXPO b jectType meth od to au tomatica lly reload XPO b jectType in stan ces in th e fu tu re.Please let me kn ow if th is h elps.
[C#]
Leave a Comment
If you need additional product information, write to us at [email protected] or call us at +1 (818) 844-3383
Open in popup window
Q403538 - Provide some method to really update XPObjectTypes | DevExpress Support Center 25-May-15
https://www.devexpress.com/Support/Center/Question/Details/Q403538 2 / 2
Provide some method to really update XPObjectTypesRelated Questions1Solution