Print Page | Close Window

Few questions

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=380
Printed Date: 01-Apr-2025 at 2:08pm


Topic: Few questions
Posted By: mymoosani
Subject: Few questions
Date Posted: 22-Aug-2007 at 1:26pm

Hi,

I am new to devforce and learning thru tutorials. While reading I have following questions in mind.

i- What is the solution for composite primary keys How these are handled in DevForce

ii- Suppose If I have a Table for multiple kind of activities and I want to keep a serial for each activity. This is other than primary key.

  what we do previously is to get a temporary serial number per activity type, so user should know and mark his document, but on save it may get different  number if another user on network utilize that number. how that kind of scenario  is handled in devforce. As I read, it generates the primary key automatically. Is there any way to generate another key at the time of save.

 

iii- Suppose I need the functionality of Add thru Combo eg: IdeabladeTutoria Database > Managers: I need combo of Manager on Employee form like

 <<AddNew>>

 ------------------------

 DAVOLIO, Nancy

 FULLER, Andy

 

  at the same time I want the functionality of Null Entity, if Manager is not selected, it should show (Not Provided)....

  this means that in mManagers Binding source, I should have three Null Entity..... if yes then How do I put their captions

  and how I will identify which one is selected to purform appropriate action....

 

 




Replies:
Posted By: kimj
Date Posted: 23-Aug-2007 at 5:26pm
1) Composite primary keys are allowed within DevForce
 
2) There are a couple options here. 
  • The best way to handle this might be to use a database insert trigger to set the real serial number during save.  DevForce by default will re-query saved data and merge it back into cache.
  • If you don't want to use a trigger, another option is to listen for the PersistenceManager.EntitySavingEvent, and in the handler set the real serial number on the entities passed.  This event is fired on the client before the actual save logic kicks in, and is not part of a transactional save.
  • On the server, the only interception point currently available is in the Entity.SaveSecurityCheck, which when implemented is called for each entity to be saved.  You can set the real serial number here, but note that this method is called before the save transaction begins.
  • Finally, there's really nothing in the IIdGenerator that knows whether primary keys are being used, so it's potentially doable to use a custom IdGenerator for this, although this would be an undocumented and unsupported use of the IdGenerator.  Id fixup (mapping of temporary to real ids) occurs on the server, before the save transaction begins

3) Our standard column binder for the combo box doesn't support adding new items, but we do have a sample which shows how to build a custom binder.  Email mailto:support@ideablade.com - support@ideablade.com directly to have this sample sent to you.




Print Page | Close Window