Newbie problems

Newbie problems

Old forum URL: forums.lhotka.net/forums/t/3389.aspx


dlrivada posted on Thursday, August 16, 2007

Hello,

I’m newbie in CSLA and I think that’s the reason for me having problems with something as easy as following:

 I have a Web page that can be visited by everyone, but if you log on with the right user, the Web page puts itself in an edit mode, allowing content changes (basically text). Moreover, the Web will be showed different for each company you want to see (I have solved it using dynamic host header, selecting the right company and storing it in a session variable). As I read in Lhotka’s and other books, forums, and web sites, I must start with the user cases. The user has two user cases in the same web, once read only when the user is not logged in. Second case is when the user is logged in and can edit the content. With this purpose I’ve created an Editable Root Object called WebHomepage, and another Editable Root Object called Company. At the same time I’ve coded a CompanyList class of Editable Root Object type to allow insert, update, and delete Company object in the same web page. I’ll not use Grids. I’ll only use FormViews (2, once to the web page content and second to the company). My three objects would relate in following manner. CompanyList is a parent object which children are Company object with a 1-1 relation with the WebHomepage object. However, I think the model is very complicated and bothersome. This is the reason for me not being able to do it well (probably because I do not understand correctly what I read) ¿Does anybody know an easier and less complicated model? (There is one requirement: the same page the anonymous user views must be the same page that allows edition to an authenticated user as well).

On the other hand, I have found a bug in my code that was caused by my lack of understanding of the concept. In the update process of the Company´s property object, it alerts that a children object cannot be saved. If I save a parent object (CompanyList) then it tells me that the object is dirty and cannot be saved. ¿How I can save the changes?

Finally, is it right that a 1 to 1 relation between business objects is coded with two Root Objects? How I can guarantee that the relation is always 1 to 1 and never 1 to none or 1 to many?

Thank you for your help and support.

 

Copyright (c) Marimer LLC