Returns a new generic
ObjectSearcher
class.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Function GetObjectSearcher(Of T)() As ObjectSearcher(Of T) |
| Visual Basic (Usage) | Copy Code |
|---|
Dim instance As ObjectContext
Dim value As ObjectSearcher(Of T)
value = instance.GetObjectSearcher(Of T)()
|
| Managed Extensions for C++ | |
|---|
public: ObjectSearcher<T>* GetObjectSearcher<T>(); |
| C++/CLI | |
|---|
public:
ObjectSearcher<T>^ GetObjectSearchergeneric<typename T>
(); |
Type Parameters
- T
Return Value
A generic
ObjectSearcher class that allows
you to search for persistent objects.
Example
The following example shows how to get and use an
ObjectSearcher.
| C# | Copy Code |
|---|
// Creates a new ObjectContext that uses an MsSql Server as storage. ObjectContext context = new ObjectContext(new MsSqlStorage("sa", "", "localhost", "application")); // ... Other code. // Get the ObjectSearcher class for user. ObjectSearcher<User> searcher = context.GetObjectSearcher<User>(); // Find all user matching the name. The result is sorted by name. ObjectSet<User> objectSet = searcher.FindAll("Name like {0} SortBy Name Asc", "%mith%"); foreach(User user in objectSet) { // Do something. } |
Remarks
Requirements
Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family
See Also