public object this[Type type]
        {
            get
            {
                var key            = ProfileStorage.Key(type);
                var profileStorage = _persister.FindBy(_profileId, key).FirstOrDefault();
                return(profileStorage != null?profileStorage.GetValue() : null);
            }
            set
            {
                if (value == null)
                {
                    return;
                }

                var key          = ProfileStorage.Key(value.GetType());
                var valueStorage = _persister.FindBy(_profileId, key).FirstOrDefault();

                if (valueStorage != null)
                {
                    valueStorage.SetValue(value);
                    _persister.Update(valueStorage);
                }
                else
                {
                    valueStorage = new ProfileStorage(new TypeNameWithoutVersion(value.GetType()))
                    {
                        ProfileId = _profileId.Value
                    };
                    valueStorage.SetValue(value);
                    _persister.Insert(valueStorage);
                }
            }
        }
예제 #2
0
        public void Insert(params ProfileStorage[] profileStorages)
        {
            foreach (var storageName in _storageNames)
            {
                foreach (var profileStorage in profileStorages)
                {
                    profileStorage.Name = storageName.Value;
                }

                _persister.Insert(profileStorages);
            }
        }
 public void Insert(params ProfileStorage[] profileStorages)
 {
     _persister.Insert(profileStorages);
 }