comparison Agendas/trunk/src/Agendas.Domain/IdentityContext.cs @ 54:3059a5f8930f

Code cleanup
author nelopauselli
date Sat, 14 May 2011 13:01:24 -0300
parents 3ebe89c88caa
children db4b1e2cae49
comparison
equal deleted inserted replaced
53:d149bfea3892 54:3059a5f8930f
1 using AltNetHispano.Agendas.Domain.Exceptions; 1 using AltNetHispano.Agendas.Domain.Exceptions;
2 2
3 namespace AltNetHispano.Agendas.Domain 3 namespace AltNetHispano.Agendas.Domain
4 { 4 {
5 public class IdentityContext 5 public class IdentityContext
6 { 6 {
7 private static ISeguridad _current; 7 private static ISeguridad _current;
8 8
9 public static ISeguridad Current 9 public static ISeguridad Current
10 { 10 {
11 private get { 11 private get
12 if (_current == null) 12 {
13 throw new IdentityContextNotConfiguredException(); 13 if (_current == null)
14 return _current; 14 throw new IdentityContextNotConfiguredException();
15 } 15 return _current;
16 set { 16 }
17 _current = value; 17 set { _current = value; }
18 } 18 }
19 }
20 19
21 public static string GetUserName() 20 public static string GetUserName()
22 { 21 {
23 var username = Current.GetUserName(); 22 string username = Current.GetUserName();
24 if (string.IsNullOrWhiteSpace(username)) 23 if (string.IsNullOrWhiteSpace(username))
25 throw new UsuarioNoAutenticadoException(); 24 throw new UsuarioNoAutenticadoException();
26 return username; 25 return username;
27 } 26 }
28 } 27 }
29 } 28 }