protected override void OnInit(EventArgs e)
    {
        if (!BXPrincipal.Current.IsCanOperate(BXRoleOperation.Operations.ProductSettingsManage))
            BXAuthentication.AuthenticationRequired();

        string id = Request.QueryString["id"];
        if (string.IsNullOrEmpty(id))
            this.entityId = 0;
        else
        {
            try
            {
                this.entityId = Convert.ToInt32(Request.QueryString["id"]);
            }
            catch
            {
                this.entityId = 0;
            }
        }

        if (this.entityId == 0)
            this.entity = new BXStorageConfiguration();
        else if ((this.entity = BXStorageConfiguration.GetById(EntityId, BXTextEncoder.EmptyTextEncoder)) == null)
        {
            this.editorError = StorageConfigEditorError.IsNotFound;
            this.errorMessageText = GetMessageRaw("Message.EntityIsNotFound");
            return;
        }
        this.editorMode = this.entity.IsNew ? BXAdminPageEditorMode.Creation : BXAdminPageEditorMode.Modification;

        List<BXTypeInfo> storageInfoLst = new List<BXTypeInfo>();
        foreach (BXTypeInfo storageInfo in BXStorageManager.GetStorageInfos())
        {
            //do not include BXFileSystemStorage - is not cloud storage
            if (!string.Equals(storageInfo.Name, typeof(BXFileSystemStorage).FullName, StringComparison.OrdinalIgnoreCase))
            {
                storageInfoLst.Add(storageInfo);
            } 
        }
        this.storageInfos = storageInfoLst.ToArray();

        List<BXStorageSettingsEditor> storageSettingsEditorLst = new List<BXStorageSettingsEditor>();
        foreach(BXTypeInfo storageInfo in this.storageInfos)
        {
            BXStorageSettingsEditor editor = BXStorageManager.CreateStorageSettingsEditor(storageInfo.Name);
            if (editor != null)
            {
                storageSettingsEditorLst.Add(editor);
                if (!this.entity.IsNew && string.Equals(this.entity.StorageTypeName, storageInfo.Name, StringComparison.OrdinalIgnoreCase))
                {
                    editor.Settings = this.entity.StorageSettings;
                }
            }
        }
        this.storageSettingsEditors = storageSettingsEditorLst.ToArray();

        MasterTitle = Page.Title = this.editorMode == BXAdminPageEditorMode.Creation ? GetMessage("PageTitle.Creation") : string.Concat(GetMessage("PageTitle.Modification"), " #", EntityId.ToString());
        base.OnInit(e);
    }
        public StorageConfigWrapper(BXStorageConfiguration entity, BXAdminPage page)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");
            this.entity = entity;

            if(page == null)
                throw new ArgumentNullException("page");
            this.page = page;
        }