Quick question regarding the use of Singleton lifestyle in Windsor, and Asp.Net MVC. If the following class is registered as a singleton am I correct in thinking that I will have a race condition?
public class UserMapper : IMap
{
public void Map(MyDto dto, MyD开发者_Go百科omain domain)
{
domain.Username = dto.Username;
domain.Firstname = dto.Firstname;
domain.Surname = dto.Surname;
domain.Password = dto.Password;
}
}
Your UserMapper
does not have any data in it - everything in the Map
method relies on parameters given to it, making the method reentrant and thus safe to use as a singleton.
精彩评论