Click or drag to resize

WithRepository Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
A WithRepository object is used to temporarily set Repository.CurrentThreadRepository within a using block. At the end of the using block, when the WithRepository is disposed, Repository.CurrentThreadRepository is returned to its value before the using block.
Inheritance Hierarchy
SystemObject
  Telogis.GeoBase.RepositoriesWithRepository

Namespace:  Telogis.GeoBase.Repositories
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public class WithRepository : IDisposable

The WithRepository type exposes the following members.

Constructors
  NameDescription
Public methodWithRepository
Remembers Repository.CurrentThreadRepository and then sets it to the given repository.
Top
Methods
  NameDescription
Public methodDispose
Reverts Repository.CurrentThreadRepository to its value when the WithRepository was created.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
C#
Repository usaRepo = new SimpleRepository("USA.gbfs");
Repository canadaRepo = new SimpleRepository("Canada.gbfs");

Repository.CurrentThreadRepository = usaRepo;

// Perform operations using USA.gbfs
Debug.Assert(Repository.CurrentThreadRepository == usaRepo);

using (new WithRepository(canadaRepo)) {
    // Perform operations using Canada.gbfs
    Debug.Assert(Repository.CurrentThreadRepository == canadaRepo);
}

// Perform operations using USA.gbfs
Debug.Assert(Repository.CurrentThreadRepository == usaRepo);
See Also