[gentle] working now, but found 2 bugs?
Brought to you by:
mnmr
From: Thomas S. <th...@th...> - 2007-07-23 16:19:34
|
Thanks, drazen. The docs site was down otherwise I would have read that. The MyGeneration Gentle2.0 template generates a class that inherits from Entity. It appears that when Entity instantiates, it locks to a provider. Am I correct in understanding that if I want the other data binding benefits of inheriting from Entity (rather than just implementing IEntity), but without the mandatory ProviderLock, I'll have to inherit from a customized Entity base class (or create my own equivalent) that leaves out the providerLock by default, but still offers a way to lock it when desired? Is there anything that strikes you as "wrong" about doing this? I just tried this and have it instantiating fine now without auto-connecting to the datasource, and it also connects to data source for other EXE fine too. However, I'm run into 2 new troubles. 1) When I instantiate a basic Gentle.Persistence.Entity subclass, I get a bunch of Exception notices in my debug window. It appears this is related to the ProviderLock portion of the code. Is there something I can do to prevent these exceptions from happening? A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll A first chance exception of type 'System.InvalidOperationException' occurred in System.dll 'WmcGui.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web. dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WmcGui.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\Thomas\My Documents\Visual Studio 2005\Projects\IGT\Rita\bin\Debug\Gentle.Reflection.dll', Symbols loaded. A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll 'WmcGui.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\Thomas\My Documents\Visual Studio 2005\Projects\IGT\Rita\bin\Debug\Gentle.Provider.SQLServer.dll', Symbols loaded. 'WmcGui.vshost.exe' (Managed): Loaded 'C:\Documents and Settings\Thomas\My Documents\Visual Studio 2005\Projects\IGT\Rita\bin\Debug\QuickGraph.dll', No symbols loaded. A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll 'WmcGui.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\Sy stem.Transactions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'WmcGui.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50 a3a\System.EnterpriseServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll A first chance exception of type 'System.FormatException' occurred in mscorlib.dll 2) There's a bug when doing an entity.Retrieve(int primkey). When the [TableColumn] attribute for the primary key of a table is significantly different than the Property name that it decorates, there's a function in the prop name lookup that fails. It works fine if the table name and property name are basically the same (disregarding case), but fails if, as in my case, the table name has an underscore, but the property name doesn't. i.e. the following fails: [TableColumn("customer_number", IsNullAllowed=false), PrimaryKey(IsAutoGenerated=false)] public string CustomerNumber The following is the section of code that causes the problem. It looks like the actual correct property name is saved in the memberMap, it's just the check that tests whether it matches the column name that fails. Is this check necessary? It seems desirable to be able to have the column name and decorated property name be different. In the case below, memberName == "customer_number", and name == "CustomerNumber", so the [if( memberName.Equals( name.ToLower() ) )] evaluates to false, which is the bug, in my opinion. This results in an unhandled exception and the correct row is not retrieved. I got around it by renaming my tables to not have "_", though I could have changed this bit of code too. Another option would be to decorate the private members of the object and name them with "_", but that seems like an arbitrary requirement when the memberMap has the correct mapping, it just needs to use it correctly. /// <summary> /// Obtain the MemberMap of a specific member given its name. /// </summary> /// <param name="memberName">The name of the member to search for.</param> /// <returns>The corresponding MemberMap or null if none was found.</returns> public MemberMap FindMember( string memberName ) { Check.VerifyNotNull( memberName, Error.NullParameter, "memberName" ); memberName = memberName.Trim().ToLower(); foreach( MemberMap memberMap in this ) { string name = memberMap.MetaMember != null ? memberMap.MemberName : memberMap.ColumnName; if( memberName.Equals( name.ToLower() ) ) { return memberMap; } } return null; } Thomas From: gop...@li... [mailto:gop...@li...] On Behalf Of Drazen Penic Sent: Saturday, July 21, 2007 4:02 AM To: Gentle development Subject: Re: [gentle] possible to use a VO with no backend connection available? For Gentle 2 Morten wrote example - read http://www.mertner.com/confluence/display/Gentle/Design+Recommendations In Gentle 1 you can do similar thing: decorate class members or properties with Gentle attributes and then you can persist objects with Broker methods (see http://www.mertner.com/confluence/display/Gentle/3.1+-+A+Basic+Example). You can put persist methods in some "Repository" class. drazen ----- Original Message ----- From: Thomas Spellman <mailto:th...@th...> To: gop...@li... Sent: Friday, July 20, 2007 10:40 PM Subject: [gentle] possible to use a VO with no backend connection available? I have two EXEs that both use a common DLL , which contains a VO (value object). One of the EXEs needs to instantiate the VO and get/set its properties, without having a db provider and without doing any persistence to a db. The other EXE needs to instantiate the same VO class, and then also be able to persist it to the DB, retrieve instances from the DB, use simple one2many relations, etc. I'm hoping this is possible with just config settings, or minor alterations to the VO objects using either gentle 1.x or gentle 2.0. I like the auto-generated classes made by the 2.0 MyGeneration script better since they use generics, etc. I'm using the current HEAD from SVN and the classes auto generated by MyGeneration using the BusinessEntity2.csgen script. T _____ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _____ _______________________________________________ Gopf-devel mailing list Gop...@li... https://lists.sourceforge.net/lists/listinfo/gopf-devel |