Friday, June 13, 2008

Nhibernate with tirggers

I was working on Nhibernate Framework, I found a feature in this framework that I want to explain you.
I have to make a transaction between two tables they have parent and child relation on child creation or updating a trigger is fired take sum of child rows and update into parent.
Everything doing fine with transaction no exception but no updating in parent record after hitting trigger.That’s amazing for me .Long story short actually Nhibernate having a state of parent with previous values again updated on commit of transaction.So, I have to create a separate transaction for parent and child also. And don’t forget to Call NHibernateSession.Flush();after commit a transaction. Like

But it’s very critical in the situation when you have to ensure that every thing should be in one go(transaciton) then realy it’s a question.I had faced this problem in the same project,but fourtunately I have a columns which shows record is deleted in first transaction I pass this true isdeleted=true and after commiting and flushing .Begin another transaction the then pass isdeleted=false.Because my trigger only works on isdeleted=false record.Anyhow its just a one solution which works in my scenario.if any one has some good idea please share with us.

Friday, June 6, 2008

Feature Framework Code

Recursively I have to drill down all the control, one thing off course every table row, td should be tagged as runat=”server” and with proper Ids.

foreach (Control pageChildControl in Page.Controls)
if (pageChildControl is HtmlForm)
HtmlForm frmControl = (HtmlForm) pageChildControl;
frmControl.Attributes.Add(m_LinkedId, m_PageFeatureId.ToString());
formControl = pageChildControl;

if (formControlCollection != null)
foreach (Control formChildControl in formControlCollection.Controls)
if (formChildControl is AsynchPanel)
AsynchPanel lbPanel = (AsynchPanel) formChildControl;
string parentId = ExtractControlLinkedId(lbPanel.Parent);
lbPanel.Attributes.Add(m_LinkedId, parentId);

else if (formChildControl is HtmlTable)
if (CheckFeatureExistanceInParent(formChildControl, string.Empty))
if (!formChildControl.Visible)
I have also attached code with it which I have written .Still I am working on it due to urgent task and off course following timeline I have postponed this for some time.

Wednesday, June 4, 2008

Feature FrameWrok

Last week I worked on some sort of parser for my own security in the application. My application domain is financial application is for Private Equity Funds and its distributions.
Actually our requirement is we want to assign rights on each and every item in the application. Some of them I am sharing with you .like.
Restriction on field level like one user can’t see this field but can see others. For example an ordinary user can’t see the head’s phone numbers, although he can see all other information.
Similarly on changing of any fund user logged in user should have rights to see the incoming data. Restriction level is up to the gird’s columns level .Logged in user can see this columns only depends on his rights.
And I will write about when I start working on the security of methods either Logged in User can call this method or not. I am thinking about enterprise security library for this. Let see
For the every feature security we assume every item in my application either it’s control or any data it’s a feature. This is DataBase view of my feature FrameWork.