Sunday 15 February 2015

asp.net mvc 3 - C# JOIN vs. Stored Procedure in Sql Server, Which one brings a better performance? -


I should change the question like this:

Which of the following is the performance of one Will an application increase?

  1. A method in C # that gives 6 joint statements and returns a value.
  2. A stored procedure that does 6 JOIN statements

    In the case of application performance, which of the above would be more efficient?

    Here is the code:

      Public Bull UserHasAccess (string user name, string actionName) {var decodedUserName = UtilityHands.GeneralTools.DecodeString (userName); Using (MAHAL_E_MA_Repository.UnitOfWork unit = new UnitOfWork ()) {var theUserID = unit.UserRepository.Get (filter: s => s.UserName.Equals (decodedUserName)). First () ID; Var user Innerol group = unit. Roll Group User Repository.Get (Filter: R => RUSSER INROLL == theUserID) .Oolist (); Var roll insolar group = unit. Rollofferolroup repository (gate). ToList (); Var serviceofrol = unit Service Offroll Repository (GET). ToList (); Var serviceoffactation = unit. ServiceOfActionRepository.Get (). ToList (); Var roles = unit Reel repository (gate). ToList (); Var service = unit. ServiceRepository.Get (). ToList (); Var actions = unit.ActionProviderRepository.Get (). ToList (); On rolesOfRoleGroupJoin = userInRoleGroup.Join (roleInRoleGroups, (U = & gt; u.RoleGroupID), (r = & gt; r.RoleGroupID), ((U, R) => New {userInRoleGroup = U, roleInRoleGroups = r} })); Top rrgOfRolesJoin = rolesOfRoleGroupJoin.Join (role, (r = & rt; r.roleInRoleGroups.RoleID), (RU = & rs; rs), ((R, RU) => New {rolesOfRoleGroupJoin = r, roles = Rs}}); On roleServiceJoin = rrgOfRolesJoin.Join (serviceOfRoles, (RRG = & gt; rrg.roles.RoleID), (TOR => sor.RoleID), ((RRG, TOR) => New {rrgOfRolesJoin = RRG, serviceOfRoles = Tire}}); (Service, value => = S})); On serviceActionJoin = serviceOfRolesServiceJoin.Join (serviceOfAction, (sponsor => sors.service.ServiceID), (SOA => soa.ServiceID), ((Sponsor, SOA) => New {serviceOfRolesServiceJoin = sponsor, serviceOfAction = SOA})); Var serviceActionWithActionJoin = serviceActionJoin.Join (verbs, (sa => sa.serviceOfAction.ActionProviderID), (a = & gt; a.ActionProviderID), ((sa, a) => new {serviceActionJoin = sa, actions = A})); Var actionNames = serviceActionWithActionJoin.Where (s => gt; s.actions.Description.Equals (actionName)); If (action name! = Null & actunams.count ()> gt; {back true; } return false; }}   

    thanks

    I think "` c # Has a method that gives approximately 6 joint statements and returns a value. "You are doing this in Linq-to-SQL or Linq-to-Entities, a query that comes into the database Translates all joints of

    In that case, a remarkable difference between the query performance plan SP and both the dynamically generated SPs (used for better performance, but this difference has been removed for many years) for both The same way has been cached.

    If you get a different, very poor performance by getting "different" results from the "memory" DB.

No comments:

Post a Comment