I am saving member information via MemberService and want to know what is the best practice for using MemberService.
At the moment I am using MembersServices a little like this:
public class MyClass
{
private IMemberService _memberService;
public MyClass(IMemberService memberService)
{
_memberService = memberService;
}
public void SaveMyMember(int id)
{
var member = _memberService.GetById(id);
member.SetValue("happy","always") ;
_memberService.Save(member);
}
}
There is a problem with the above code as we are making two calls to the database, one to get the member and one to save the updated member value. This isn't a problem with a few members but at scale, we are seeing Deadlocking problems and believe it would be better to read the member data from Examine, then have a single call to MembersServices to save the member.
This however doesn't seem to be possible as you need a copy of IMember to pass to _memberService.Save and it looks like the only practical way to get IMember is via _memberService.GetById(id).
Any ideas, taking into account hundreds of thousands of members and thousands of member update requests per member?
MemberService Get and Save best practice
I am saving member information via MemberService and want to know what is the best practice for using MemberService.
At the moment I am using MembersServices a little like this:
There is a problem with the above code as we are making two calls to the database, one to get the member and one to save the updated member value. This isn't a problem with a few members but at scale, we are seeing Deadlocking problems and believe it would be better to read the member data from Examine, then have a single call to MembersServices to save the member.
This however doesn't seem to be possible as you need a copy of IMember to pass to _memberService.Save and it looks like the only practical way to get IMember is via _memberService.GetById(id).
Any ideas, taking into account hundreds of thousands of members and thousands of member update requests per member?
is working on a reply...