Ejemplo n.º 1
0
 void ICriteriaPersister.OnSaving(Criteria criteria)
 {
     if (criteria is EmployerSearchCriteria)
     {
         _employerPersister.OnSaving(criteria);
     }
     else if (criteria is MemberSearchCriteria)
     {
         _memberPersister.OnSaving(criteria);
     }
 }
Ejemplo n.º 2
0
        public static EntitySet <TCriteriaEntity> MapTo <TCriteriaEntity, TCriteria>(this TCriteria criteria, Guid id, ICriteriaPersister criteriaPersister, bool persistantIsString)
            where TCriteriaEntity : class, ICriteriaEntity, new()
            where TCriteria : Criteria
        {
            var entities = new EntitySet <TCriteriaEntity>();

            criteriaPersister.OnSaving(criteria);

            // Create the set entity and then attach all items that need to be persisted.

            foreach (var item in criteria.GetPersistantItems(persistantIsString))
            {
                entities.Add(new TCriteriaEntity {
                    id = id, name = item.Name, value = item.Value
                });
            }

            criteriaPersister.OnSaved(criteria);
            return(entities);
        }