Exemple #1
0
            public IUserAssetEntity GetEntity(Guid guid)
            {
                return(entities.GetOrCreate(guid, () =>
                {
                    var element = elements.GetOrThrow(guid);

                    Type type = UserAssetNames.GetOrThrow(element.Name.ToString());

                    var entity = giRetrieveOrCreate.GetInvoker(type)(guid);

                    entity.FromXml(element, this);

                    previews.Add(guid, new UserAssetPreviewLineEmbedded
                    {
                        Text = entity.ToString() !,
                        Type = entity.GetType().ToTypeEntity(),
                        Guid = guid,
                        Action = entity.IsNew ? EntityAction.New :
                                 customResolutionModel.ContainsKey(entity.Guid) ? EntityAction.Different :
                                 GraphExplorer.FromRoot((Entity)entity).Any(a => a.Modified != ModifiedState.Clean) ? EntityAction.Different :
                                 EntityAction.Identical,
                        CustomResolution = customResolutionModel.TryGetCN(entity.Guid),
                    });

                    return entity;
                }));
Exemple #2
0
            public IUserAssetEntity GetEntity(Guid guid)
            {
                return(entities.GetOrCreate(guid, () =>
                {
                    var element = elements.GetOrThrow(guid);

                    Type type = UserAssetNames.GetOrThrow(element.Name.ToString());

                    var entity = giRetrieveOrCreate.GetInvoker(type)(guid);

                    if (entity.IsNew || overrideEntity.ContainsKey(guid))
                    {
                        entity.FromXml(element, this);
                        using (OperationLogic.AllowSave(entity.GetType()))
                            entity.Save();
                    }

                    return entity;
                }));
            }