指定したアプリケーション ドメインとアセンブリの証拠オブジェクトに対応する分離ストレージを取得します。
Overloads Public Shared Function GetStore( _
ByVal scope As IsolatedStorageScope, _ ByVal domainIdentity As Object, _ ByVal assemblyIdentity As Object _) As IsolatedStorageFile
[C#]
public static IsolatedStorageFile GetStore(IsolatedStorageScopescope,objectdomainIdentity,objectassemblyIdentity);
[C++]
public: static IsolatedStorageFile* GetStore(IsolatedStorageScopescope,Object* domainIdentity,Object* assemblyIdentity);
[JScript]
public static function GetStore(
scope : IsolatedStorageScope,domainIdentity : Object,assemblyIdentity : Object) : IsolatedStorageFile;
パラメータ
- scope
IsolatedStorageScope 値のビットごとの組み合わせ。 - domainIdentity
アプリケーション ドメイン ID の証拠を格納している Object 。 - assemblyIdentity
コード アセンブリ ID の証拠を格納している Object 。
戻り値
指定したパラメータを表す IsolatedStorageFile 。
例外
例外の種類 | 条件 |
---|---|
SecurityException | 分離ストレージに対して必要なアクセス許可が与えられていません。 |
ArgumentNullException | domainIdentity と assemblyIdentity のいずれも渡されていません。正しいコンストラクタが使用されているかどうかを検証します。
または domainIdentity または assemblyIdentity が null 参照 (Visual Basic では Nothing) です。 |
ArgumentException | scope が無効です。 |
解説
この形式の GetStore は、ストアを別のアセンブリであるかのように開く必要がある管理用コードで使用すると便利です。ストアは、現在実行されているアセンブリではなく、指定された証拠に対して開かれます。
たとえば、ローミングに対応し、アプリケーション間で共有されるアセンブリのストアを開くには、次のコードを使用します。
Dim scope AS IsolatedStorageScope
scope = (IsolatedStorageScope.User Or IsolatedStorageScope.Assembly Or IsolatedStorageScope.Roaming)
Dim isoStore As IsolatedStorageFile
isoStore = IsolatedStorageFile.GetStore(scope, Nothing, Nothing)
[C#]
IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Roaming;
IsolatedStorageFile store = IsolatedStorageFile.GetStore(scope, null, null);
または、ローミングに対応し、同じアセンブリのアプリケーション固有のストアを開くには、次のコードを使用します。
Dim scope AS IsolatedStorageScope
scope = (IsolatedStorageScope.User Or IsolatedStorageScope.Assembly Or IsolatedStorageScope.Domain Or IsolatedStorageScope.Roaming)
Dim isoStore As IsolatedStorageFile
isoStore = IsolatedStorageFile.GetStore(scope, Nothing, Nothing)
[C#]
IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain | IsolatedStorageScope.Roaming;
IsolatedStorageFile store = IsolatedStorageFile.GetStore(scope, null, null);
Note[note]: scope が Domain であり、アセンブリがインストールされているアプリケーション ドメインが IsolatedStorageFilePermission を持たない場合、 GetStore はクォータを指定せずに IsolatedStorageFile を返します。クォータを持たない IsolatedStorageFile を使用して IsolatedStorageFile オブジェクトを後で作成しようとすると、 IsolatedStorageException が発生して失敗します。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- IsolatedStorageFilePermission (分離ストレージを使用するために必要なアクセス許可) AssemblyIsolationByUser (関連する列挙体)
- ReflectionPermission (Type.InvokeMember などの機構を通じて遅延バインディングで呼び出すときに必要なアクセス許可) ReflectionPermissionFlag.MemberAccess (関連する列挙体)
参照
IsolatedStorageFile クラス | IsolatedStorageFile メンバ | System.IO.IsolatedStorage 名前空間 | IsolatedStorageFile.GetStore オーバーロードの一覧 | GetUserStoreForAssembly | GetUserStoreForDomain | 分離ストレージのクォータ