Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error in code - with Stored Proc
Message
De
28/07/2004 09:24:55
 
 
À
28/07/2004 02:18:09
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, Californie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00928301
Message ID:
00928668
Vues:
26
Jason,

I knew that Shawn was using MM, but since his example didn't show an MM class, I didn't know if he was actually using an MM class or if it was something he rolled on his own. In this case, since you say that MM handles this issue using an Interface, your solution is definitely preferable to mine. I was trying to show him something simple first. <g>

~~Bonnie



>Bonnie and Shawn
>
>This is exactly what's already happening in MM, using the ImmBusinessRuleHost interface. Shawn, check out your CompanyRules constructor
>
>
>//Here, hostObject contains a reference
>// to the object that created it, Company
>public CompanyRules(ImmBusinessRuleHost hostObject)
>
>
>Check out the "Using the HostObject Property" section of the topic "Creating Custom Business Rule Objects" in the DevGuide. It has a good example of how to reference objects that create rules objects.
>
>Sorry I didn't notice this was the issue earlier!
>---J
>>Shawn,
>>
>>You have a coupla options here, but probably the easist is to create a Constructor for CompanyRules that accepts a parameter of type Company and pass a reference to the calling Company object. Something like this:
>>
>>public class CompanyRules
>>
>>  private Company oCompany;
>>
>>  public CompanyRules(Company o)
>>  {
>>    this.oCompany = o;
>>  }
>>
>>  // then, when you need to call the method
>>  this.oCompany.getDataSet();
>>}
>>
>>The Company class would instantiate the CompanyRules class like this:
>>
>>  private CompanyRules oRules = new CompanyRules(this);
>>
>>There are other options, like using Interfaces, but try this first and see if you can get it working.
>>
>>~~Bonnie
>>
>>
>>
>>>This is what is happening I think.
>>>The form instantiates
>>>In the form load it calls New Company()
>>>In Company it creates CompanyRules()
>>>In CompanyRules() I want to access a getDataSet method in Company, so I thought I would create a New Company() Object
>>>
>>>I think this is the problem with the recursion you are mentioning.
>>>
>>>Stack Overflow is Happening in Main. I load the form and it all crashes with stack overflow.
>>>Working on that now.
>>>
>>>Thanks for the pointers and where to look.
>>>
>>>New Languages...this is why i have no hair left!!! :-)
>>>
>>>
>>>-->Shawn
>>>
>>>
>>>
>>>>>Thanks Bonnie, I did add the new Company to it and now i get a stack overflow error.
>>>>>the whole prgram crashes out.
>>>>>
>>>>>Is it a problem that company is created on the main form. and then i try to create it again?
>>>>
>>>>Shawn,
>>>>
>>>>Where are you getting the stack overflow error? Normally creating multiple instances of something will not cause this sort of problem, but then again I have no idea what your class might be doing. There might be some repetitive recursion or something going on. Have you traced it?
>>>>
>>>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform