WithRepository Class |
Namespace: Telogis.GeoBase.Repositories
The WithRepository type exposes the following members.
Name | Description | |
---|---|---|
WithRepository |
Remembers Repository.CurrentThreadRepository and then sets it to the given repository.
|
Name | Description | |
---|---|---|
Dispose |
Reverts Repository.CurrentThreadRepository to its value when the WithRepository was
created.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
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);