Performance challange why shuld object take 7 second for fetching?

Performance challange why shuld object take 7 second for fetching?

Old forum URL:

Saman posted on Thursday, July 14, 2011


I searched about performance tuning in CSLA as my  application is too slow

i checked the penalty of linq and i found that performance hit is not related to it.

first of all i have a business object  Personnel that defined as follow:

    [Csla.Server.ObjectFactory("PMS.PersonnelFactory,PMS", "Create", "Fetch", "Update", "Delete")]
    public class Personnel : BusinessBase<Personnel>

  public static Personnel GetPersonnel(string id)
            FetchPersonnel type = new FetchPersonnel("ByID",id,"");
            return DataPortal.Fetch<Personnel>(new SingleCriteria<FetchPersonnel>(type));



and i have factory class:

 public Personnel Fetch(SingleCriteria<FetchPersonnel> criteria)

            var obj = (Personnel)MethodCaller.CreateInstance(typeof(Personnel));
            using (var ctx = ContextManager<PMS.DAL.PMSDALDataContext>.GetManager("PMS"))
                if (criteria.Value.SearchType == "ByID")
                        var item = ctx.DataContext.fn_GetPersonnel(criteria.Value.SerarchID).First();
                        obj = GetPersonnel(item.PersonnelID_pkey, item.NationalID_id, item.Name_name, item.Family_name, item.Image_img.ToArray(), item.OrgPost_other, item.UnitID_pkey, item.UnitName_other, item.StatusID_pkey, item.StatusName_other, item.IPAddress_ipadd, item.RoleID_pkey, item.RoleName_other, item.ActiveID_pkey, item.Password_pass, "", "", "", "", "", "", "", "", "", "");



this process takes 7 second.

am i using anything wrong?


JonnyBee replied on Thursday, July 14, 2011

Use a NET profiler to find where the time is spent.

VS2010 Professional and higher has a built in profiler that should do the job just fine.

dotTrace and Ants Profiler are more advanced commercial alternatives.

ajj3085 replied on Saturday, July 16, 2011

It would help to see your GetPersonnel method, as that's probably where the problem is.

One common thing to check would be to ensure that you wrap your statments which load data into you business object in a BypassPropertyCheck, as this will disable the normal rule running as well as the raising of various events (which no one is listening to yet anyway).

Copyright (c) Marimer LLC