Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity default values not being maintained
Message
De
25/01/2010 13:08:55
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01445715
Message ID:
01445835
Vues:
30
Bob,
This is very puzzling. I am running MM on a Windows 7 64 bit box also. I always run VS as administrator because of problems accessing the BLG if I don't. I can't imagine why that would affect your situation however. I will try to test this with a sample similar to yours and see what I get.
Tim

>Tim,
>
>Yes, the code is the same as I moved the code from the old machine to the new and this problem is with all of my business objects, not just one. In addition I am testing this right in the Business Object project using the Object Test Bench so there is no interaction with an interface.
>
>Here is an example:
>
>I have a FirmAcct business object and I run the following test bench code:
>
>
>FirmAcct oFirmAcct = new FirmAcct();
>            FirmAcctDefaults FAD = new FirmAcctDefaults(businessID, firmID);
>            oFirmAcct.NewEntity(FAD);
>            oFirmAcct.Entity.FirmAcctBankAcctNbr = bankacctNbr;
>            oFirmAcct.Entity.FirmAcctName = firmacctname;
>            oFirmAcct.SaveEntity();
>            return oFirmAcct.Rules.GetAllBrokenRules();
>
>Now, when the NewEntity method runs it steps through the HookSetDefaultValues method shown here"
>
>
>protected override void HookSetDefaultValues(DataRow dataRow)
>        {
>            FirmAcctEntity Entity = this.CreateEntityObject();
>            Entity.SetDataRow(dataRow);
>
>            if (this.DefaultValues != null)
>            {
>                // Store the dynamic default values via the entity object
>                Entity.BusinessID = Defaults.BusinessID;
>                Entity.FirmID = Defaults.FirmID;
>            }
>
>            // Store the hard-coded default values via the entity object
>            Entity.FirmAcctCashTradeSw = false;
>            Entity.FirmAcctABA = " ";
>            Entity.FirmAcctBankAcctNbr = " ";
>            Entity.FirmAcctBankName = " ";
>            Entity.FirmAcctCashAcctNbr = " ";
>            Entity.FirmAcctName = " ";
>            Entity.FirmAcctCommMinimum = 0;
>            Entity.FirmAcctCommPerShare = 0;
>            Entity.FirmAcctCustomerBrokerSw = true;
>        }
>
>
>When I get back to the test bench code after running NewEntity, I check the Entity values and the character fields are all null and the values set the the Defaults class are zero (even though I passed a value into the test code (firmID, businessID). So when the SaveEntity runs, it obviously fails due to not null constraints or foreign key contstraints due to the Entity values not being valid.
>
>For what it's worth, I copied my code to another Windows XP machine, installed MM.NET and tested and did not have this problem. The fact that this works on another computer running XP would suggest a Windows 7 (or maybe 64 bit) issue, but this is not conclusive yet.
>
>To answer your final question, I am running SQL Server 2005 on each machine independently and restored the same database from a backup on the original machine.
>
>Still confused,
>
>Bob
>
>
>>>Bob
>>
>>Bob are you saying the code is all the same and the only change was moving from one box to another? I assume you are talking about running under development and not a deployed application. Is the data in the same place also or is that moved to another datasource?
>>
>>It sounds like the default values are getting set and then some code is stepping on the values somewhere. Is the entity values bound to controls that are being changed? What are the values being set to? You could I suppose put a breakpoint on the entity property for that column and see how many times it gets set after the breakpoint on the HookSetDefaultValues.
>>Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform