Search Results

Search found 6 results on 1 pages for 'zuber'.

Page 1/1 | 1 

  • Lazy Loading Association and Casting

    - by Zuber
    I am using NHibernate 2.0.1 and .NET I am facing issues with Lazy loading an association I have a BusinessObject class that has associations to other BusinessObject in it, and it can go deeper. The following function is in the BusinessObject to read the values of a collection in the BusinessObject. public virtual object GetFieldValue(string fieldName) { var fieldItems = fieldName.Split(AppConstants.DotChar); var objectToRead = this; for (var i = 0; i < fieldItems.Length - 1; i++) { objectToRead = (BusinessObject) objectToRead.GetFieldValue(fieldItems[i]); } //if (objectToRead._data == null) return objectToRead.SystemId + " Error: _data was null"; return objectToRead.FieldValue(fieldName.LastItem()); } The FieldValue function is described below private object FieldValue(string fieldName) { return _data.Contains(fieldName) ? _data[fieldName] : null; } The BusinessObject has a dictionary_data which stores the field values. Assume the fieldName is BusinessDriver.Description and the BusinessObject which has this field is StrategyBusinessDriver This code breaks down the field name into two - BusinessDriver & Description. The first iteration reads the BusinessDriver object from StrategyBusinessDriver. It is cast into a BusinessObject type so that I can call the GetFieldValue again on it to read the next field i.e Description in the BusinessDriver. The problem is that when I read the BusinessDriver in the first iteration and cast it, I get the Ids and all other details of the BusinessObject but the field dictionary _data and other collections are not fetched. This should be fetched lazily when I read the _data of the BusinessObject. However, this does not happen and I get an error that _data is null. Is there something wrongly coded because of which the collection is not fetched lazily? Please ask for more clarifications if needed. Thanks in advance. UPDATE: It works when I don't do Lazy load.

    Read the article

  • Jquery Dialog - div disappears after initialization

    - by Zuber
    JQuery Dialog is giving me lots of pain lately. I have the following div which I want to be popped up. (Ignore that the classes do not show the double quotes in the syntax) TABLE class=widget-title-table border=0 cellSpacing=0 cellPadding=0> <TBODY> <TR> <TD class=widget-title><SPAN class=widget-title>Basic Info</SPAN></TD> <TD class=widget-action> <DIV id=edit-actions jQuery1266325647362="3"> <UL class="linkbutton-menu read-mode"> <LI class="control-actions"> <A id="action-button" class="mouse-over-pointer linkbutton">Delete this stakeholder</A> <DIV id="confirmation" class="confirmation-dialog title=Confirmation"> Are you sure you want to delete this stakeholder? </DIV> </LI></UL></DIV></TD></TR></TBODY></TABLE> The JQuery for this is ... $(document).ready(function() { $('#confirmation').dialog({ bgiframe: true, modal: true, autoOpen: false, closeOnEscape: false, draggable: true, position: 'center', resizable: false, width: 400, height: 150 }); }); And the dialog is 'open'ed by var confirmationBox = $('#confirmation',actionContent); if (confirmationBox.length > 0) { //Confirmation Needed $(confirmationBox).dialog('option', 'buttons', { 'No': function() { $(this).dialog('close'); }, 'Yes': function() { $('ul.read-mode').hide(); $.post(requestUrl, {}, ActionCallback(context[0], renderFormUrl), 'json'); $(this).dialog('close'); } }); $(confirmationBox).dialog('open'); } The problem starts in the initialization itself. When the document loads, the <div #confirmation> is deleted from the markup! I had a similar issue earlier, but I cannot use that solution here. On this page I can have multiple PopUp divs. When I added the initialization in just before opening it; the form popped up. But after I close it, the div is removed; so I am not able to see the popup again.

    Read the article

  • window.onbeforeunload and window.location.href in IE

    - by Zuber
    We are using window.location.href to navigate the user to a page. Also, we have configured the window.onbeforeunload event to alert users in case there are any unsaved changes. window.onbeforeunload = confirmBeforeClose; function confirmBeforeClose() { if (jwd.global.inEditMode) return "Your changes will not be saved :) and you will be punished to death"; } In places where there are unsaved changes, and I try to use window.location.href to navigate the user, I get the alert message. It works fine if I click OK on the popup. However, if I click CANCEL, the JS throws an unspecified error at window.location.href. Any help is appreciated.

    Read the article

  • How to use Preprocessor directives in MVC aspx pages

    - by Zuber
    I am using MinifyJS.tt which is a T4 template to minify all my JS files automatically. In my aspx files, I am referencing all the javascript files. Now, I want to add a condition (maybe compiler directive) to use the original JS file when I am debugging the application, and to use the minified JS files when I simply run the application without debug. I tried using #if in the aspx page, but that did not seem to work. Can we make use of preprocessor directives in aspx pages? Is there an alternative way to achieve my goal?

    Read the article

  • Nhibernate join on a table twice

    - by Zuber
    Consider the following Class structure... public class ListViewControl { public int SystemId {get; set;} public List<ControlAction> Actions {get; set;} public List<ControlAction> ListViewActions {get; set;} } public class ControlAction { public string blahBlah {get; set;} } I want to load class ListViewControl eagerly using NHibernate. The mapping using Fluent is as shown below public UIControlMap() { Id(x => x.SystemId); HasMany(x => x.Actions) .KeyColumn("ActionId") .Cascade.AllDeleteOrphan() .AsBag() .Cache.ReadWrite().IncludeAll(); HasMany(x => x.ListViewActions) .KeyColumn("ListViewActionId") .Cascade.AllDeleteOrphan() .AsBag() .Cache.ReadWrite().IncludeAll(); } This is how I am trying to load it eagerly var baseActions = DetachedCriteria.For<ListViewControl>() .CreateCriteria("Actions", JoinType.InnerJoin) .SetFetchMode("BlahBlah", FetchMode.Eager) .SetResultTransformer(new DistinctRootEntityResultTransformer()); var listViewActions = DetachedCriteria.For<ListViewControl>() .CreateCriteria("ListViewActions", JoinType.InnerJoin) .SetFetchMode("BlahBlah", FetchMode.Eager) .SetResultTransformer(new DistinctRootEntityResultTransformer()); var listViews = DetachedCriteria.For<ListViewControl>() .SetFetchMode("Actions", FetchMode.Eager) .SetFetchMode("ListViewActions",FetchMode.Eager) .SetResultTransformer(new DistinctRootEntityResultTransformer()); var result = _session.CreateMultiCriteria() .Add("listViewActions", listViewActions) .Add("baseActions", baseActions) .Add("listViews", listViews) .SetResultTransformer(new DistinctRootEntityResultTransformer()) .GetResult("listViews"); Now, my problem is that the class ListViewControl get the correct records in both Actions and ListViewActions, but there are multiple entries of the same record. The number of records is equal to the number of joins made to the ControlAction table, in this case two. How can I avoid this? If I remove the SetFetchMode from the listViews query, the actions are loaded lazily through a proxy which I don't want.

    Read the article

  • Load collections eagerly in NHibernate using Criteria API

    - by Zuber
    I have an entity A which HasMany entities B and entities C. All entities A, B and C have some references x,y and z which should be loaded eagerly. I want to read from the database all entities A, and load the collections of B and C eagerly using criteria API. So far, I am able to fetch the references in 'A' eagerly. But when the collections are loaded, the references within them are lazily loaded. Here is how I do it AllEntities_A = _session.CreateCriteria(typeof(A)) .SetFetchMode("x", FetchMode.Eager) .SetFetchMode("y", FetchMode.Eager) .List<A>().AsQueryable(); The mapping of entity A using Fluent is as shown below. _B and _C are private ILists for B & C respectively in A. Id(c => c.SystemId); Version(c => c.Version); References(c => c.x).Cascade.All(); References(c => c.y).Cascade.All(); HasMany<B>(Reveal.Property<A>("_B")) .AsBag() .Cascade.AllDeleteOrphan() .Not.LazyLoad() .Inverse() .Cache.ReadWrite().IncludeAll(); HasMany<C>(Reveal.Property<A>("_C")) .AsBag() .Cascade.AllDeleteOrphan() .LazyLoad() .Inverse() .Cache.ReadWrite().IncludeAll(); I don't want to make changes to the mapping file, and would like to load the entire entity A eagerly. i.e. I should get a List of A's where there will be List of B's and C's whose reference properties will also be loaded eagerly

    Read the article

1