An interface that is implemented to create custom queries for a persistent object's insert,
update and delete operations.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Interface IPersistentQueriesProvider |
| C# | |
|---|
public interface IPersistentQueriesProvider |
| Managed Extensions for C++ | |
|---|
public __gc __interface IPersistentQueriesProvider |
| C++/CLI | |
|---|
public interface class IPersistentQueriesProvider |
Example
This example shows how to implement the IPersistentQueriesProvider interface and how to register
it with the
ObjectContext.
| C# | Copy Code |
|---|
public sealed class CallQueriesProvider : IPersistentQueriesProvider { public IQuery GetInsertQuery(IStorage storage, object persistent) { // Return the null to have the framework create the query. return null; } public IQuery GetUpdateQuery(IStorage storage, IQuery query, object persistent) { Call c = (Call)persistent; // Check if the storage is the MsSqlStorage. if (storage is MsSqlStorage) { // If that's true, create a custom query and return that query. return new SqlQuery("UPDATE CALLS SET DURATION = {0} WHERE ID = {1}", c.Duration, c.ID); } // Otherwise return null. return null; } public IQuery GetDeleteQuery(IStorage storage, IQuery query, object persistent) { // Return the null to have the framework create the query. return null; } // Return the type of persistent this class has been created for. public Type PersistentType { get { return typeof(Call); } } } // ... Other code. // Register the provider with the ObjectContext instance. context.PersistentQueriesProviders.Add(new CallQueriesProvider()); |
Remarks
Requirements
Namespace: Chili.Opf3
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Chili.Opf3 (in Chili.Opf3.dll)
See Also