New Posts New Posts RSS Feed: Process for creating new Base View?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Process for creating new Base View?

 Post Reply Post Reply Page  <12
Author
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Topic: Process for creating new Base View?
    Posted: 25-Sep-2007 at 9:41am
I don't think there is only one persistence manager involved.  I vaguely remember Ward saying something in training one time about a pm per view, or something like that.  Is it possible that you are calling the save on a pm that does not have the changes that you made?  Just a thought...you probably already checked that, though.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2007 at 9:47am
The problem is that I am not controlling the save button. It is in the PageView control.
 
 
Back to Top
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2007 at 9:52am

You may have to implement your own save/delete routines for the triple-pane layout that you created.  I suppose you could somehow wiggle into the context of the parent layout, but that'll take some work, too.  Hopefully, the big guns will weigh in on this again someday.



Edited by Linguinut - 25-Sep-2007 at 9:56am
Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2007 at 10:37am
I think Bill C. is right; it's a problem with the wrong persistence manager.
 
In my update to the LayoutDemo app posted earlier in this thread, the UserSecurityCode entity has a static Create() method that doesn't accept a persistence manager:

UserSecurityCode newItem = UserSecurityCode.Create(currentUser, selectedRole);

Inside this create method is the line:

UserSecurityCode assoc =

pUser.PersistenceManager.CreateEntity<UserSecurityCode>();

As you can see, it uses the persistence manager it retrieves from the User entity.  I suggest you try this.
 
Within pages whose page controller inherit from PageController<entitytype>, the persistence manager is wrapped in an EntityManager that assists in maintaining synchrony between multiple views without round trips to the persistence server.  Again in my earlier post on this thread, I retrieve the initial UserSecurityCodes with:

RdbQuery query = new RdbQuery(typeof(UserSecurityCode), UserSecurityCode.UserIdEntityColumn, EntityQueryOp.EQ, user.Id);

list = EntityManager.PersistenceManager.GetEntities<UserSecurityCode>(query, pStrategy);

It is on this persistence manager that SaveChanges() will be called when Save is selected.
 
Hope this helps.
 
Bill J.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2007 at 10:44am
tx. That worked. A
 
 
Any idea about the delete?
Back to Top
Bill Jensen View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Jul-2007
Location: United States
Posts: 229
Post Options Post Options   Quote Bill Jensen Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2007 at 5:14pm
Yeah.
 
It turns out that in CommonEntity (in IdeaBlade.Common.EntityModel) there are three methods:
 
AllowCreate()
AllowUpdate()
AllowDelete()
 
By default the first two return true and the third returns false.  You can override these in your entity classes (or in BaseEntity) to control what is allowed and disallowed.  In them you could place whatever logic you want to determine if the operation should proceed.  Your presenter or controller logic can also invoke them before carrying out an operation.
 
If you simply override AllowDelete() in your UserRole entity and return true you'll be able to delete.
 
Sorry not to have this sooner.
 
Bill J.
Back to Top
orcities View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Aug-2007
Location: United States
Posts: 454
Post Options Post Options   Quote orcities Quote  Post ReplyReply Direct Link To This Post Posted: 25-Sep-2007 at 5:23pm
tx. I am out until next Monday. But I will give it a shot then.
 
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down