annotate Agendas/trunk/src/Agendas.Repositories.Memory/AgendaRepository.cs @ 4:49b572535156

proponer van publicar van propuesta comportamiento ante excepcion en publicador
author nelopauselli
date Tue, 08 Feb 2011 00:08:49 -0300
parents 5f007e266509
children
rev   line source
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
1 using System;
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
2 using AltNetHispano.Agendas.Domain;
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Domain.Repositories;
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
4
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
5 namespace Agendas.Repositories.Memory
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
6 {
4
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
7 public class AgendaRepository : RepositoryBase<Agenda>, IAgendaRepository
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
8 {
3
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
9 #region IAgendaRepository Members
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
10
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
11 public void Save(Agenda agenda)
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
12 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
13 if (Guid.Empty.Equals(agenda.Id))
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
14 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
15 agenda.Id = Guid.NewGuid();
4
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
16 Objects.Add(agenda.Id, agenda);
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
17 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
18 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
19
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
20 public void Update(Agenda agenda)
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
21 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
22 //nada que hacer en este método para este repositorio
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
23 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
24
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
25 public Agenda Get(Guid agendaId)
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
26 {
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
27 Agenda agenda;
4
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
28 return Objects.TryGetValue(agendaId, out agenda) ? agenda : null;
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
29 }
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
30
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
31 public void Delete(Agenda agenda)
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
32 {
49b572535156 proponer van
nelopauselli
parents: 3
diff changeset
33 Objects.Remove(agenda.Id);
3
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
34 }
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
35
3
5f007e266509 code cleanup
nelopauselli
parents: 2
diff changeset
36 #endregion
2
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
37 }
c03560ae4762 Test de Crud para la agenda
nelopauselli
parents:
diff changeset
38 }