Exemplo n.º 1
0
 public static HostSet Get(this IDocumentSession session, HostSet set)
 {
     var result = from qSet in session.Query<HostSet>()
                  where qSet.Id == set.Id
                  select qSet;
     return result.FirstOrDefault();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates the set.
 /// </summary>
 /// <param name="set">The set.</param>
 /// <returns></returns>
 public HostSet CreateSet(HostSet set)
 {
     using (var session = this.store.OpenSession())
     {
         session.Store(set);
         session.SaveChanges();
     }
     return set;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds the host to set.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <param name="set">The set.</param>
 public void AddHostToSet(Host host, HostSet set)
 {
     using (var session = this.store.OpenSession())
     {
         var dalSet = session.Get(set);
         dalSet.Hosts.Add(host);
         session.SaveChanges();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Deactivates the set.
 /// </summary>
 /// <param name="set">The set.</param>
 /// <returns></returns>
 public HostSet DeactivateSet(HostSet set)
 {
     return ToggleSetActivation(set, true);
 }
Exemplo n.º 5
0
 protected HostSet ToggleSetActivation(HostSet set, bool value)
 {
     using (var session = this.store.OpenSession())
     {
         var dalSet = session.Get(set);
         dalSet.Active = value;
         session.SaveChanges();
     }
     return set;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Removes the host from set.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <param name="set">The set.</param>
 public void RemoveHostFromSet(Host host, HostSet set)
 {
     using (var session = this.store.OpenSession())
     {
         var dalSet = session.Get(set);
         dalSet.Hosts.Remove(host);
         session.SaveChanges();
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Deletes the set.
 /// </summary>
 /// <param name="set">The set.</param>
 /// <returns></returns>
 public HostSet DeleteSet(HostSet set)
 {
     using (var session = this.store.OpenSession())
     {
         var result = session.Get(set);
         if (result != null)
         {
             session.Delete(result);
             session.SaveChanges();
         }
     }
     return set;
 }