Ejemplo n.º 1
0
 protected virtual IObjectSaver<ObjectAccessItem> GetForSave(IUnitOfWork unitOfWork, IObjectSaver<ObjectAccessItem> objectSaver)
 {
     return objectSaver
         .SaveOneObject(x => x.Creator)
         .SaveOneToMany(x => x.UserCategories, x => x.SaveOneObject(a => a.UserCategory))
         .SaveOneToMany(x => x.Users, x => x.SaveOneObject(a => a.User));
 }
Ejemplo n.º 2
0
 private bool GetSaver(GameXmlWriter writer, Element e, out IObjectSaver saver)
 {
     if (!m_savers.TryGetValue(e.Type, out saver))
     {
         throw new Exception("ERROR: No ObjectSaver for type " + e.Type.ToString());
     }
     return(true);
 }
Ejemplo n.º 3
0
 public PersonManager(string dirPath, IObjectSaver saver, UpdateHandler updateHandler, MessageHandler errorHandler)
 {
     handleUpdate  = updateHandler;
     handleMessage = errorHandler;
     this.saver    = saver;
     this.dirPath  = dirPath;
     root          = new DirectoryInfo(dirPath);
     files         = root.GetFiles();
 }
Ejemplo n.º 4
0
 private bool GetSaver(GameXmlWriter writer, Element e, out IObjectSaver saver)
 {
     if (!m_savers.TryGetValue(e.Type, out saver))
     {
         throw new Exception("ERROR: No ObjectSaver for type " + e.Type.ToString());
     }
     return true;
 }
Ejemplo n.º 5
0
 private void AddSaver(IObjectSaver saver)
 {
     saver.ObjectSaver = this;
     m_savers.Add(saver.AppliesTo, saver);
 }
Ejemplo n.º 6
0
        public void SaveExtendedStage(IUnitOfWork uow, ExtendedStage extendedStage, IObjectSaver<ExtendedStage> stageSaver)
        {
            if (extendedStage.Extender != null)
            {
                var extenderType = extendedStage.Extender.GetType().GetBaseObjectType();

                var exStageService = _serviceResolver.GetObjectService(extenderType);
                if (exStageService.GetType().GetInterfaces().Any(x =>
                    x.IsGenericType &&
                    x.GetGenericTypeDefinition() == typeof(IStageExtenderService<>)))
                {
                    var createMethod = stageSaver.GetType().GetMethod("Create").MakeGenericMethod(extenderType);
                    var extenderSaver = createMethod.Invoke(stageSaver, new[] { extendedStage.Extender, null });

                    var saveMethod = exStageService.GetType().GetMethod("ExternalSave");
                    if (saveMethod != null)
                        saveMethod.Invoke(exStageService, new[] { uow, extenderSaver });
                }
            }
        }
Ejemplo n.º 7
0
 private void AddSaver(IObjectSaver saver)
 {
     saver.ObjectSaver = this;
     m_savers.Add(saver.AppliesTo, saver);
 }