namespace Bit.Seeder; /// /// Base interface for query operations in the seeding system. The base interface should not be used directly, rather use `IQuery<TRequest, TResult>`. /// /// /// Queries are synchronous, read-only operations that retrieve data from the seeding context. /// Unlike scenes which create data, queries fetch existing data based on request parameters. /// They follow a type-safe pattern using generics to ensure proper request/response handling /// while maintaining a common non-generic interface for dynamic invocation. /// public interface IQuery { /// /// Gets the type of request this query expects. /// /// The request type that this query can process. Type GetRequestType(); /// /// Executes the query based on the provided request object. /// /// The request object containing parameters for the query operation. /// The query result data as an object. object Execute(object request); } /// /// Generic query interface for synchronous, read-only operations with specific request and result types. /// /// The type of request object this query accepts. /// The type of data this query returns. /// /// Use this interface when you need to retrieve existing data from the seeding context based on /// specific request parameters. Queries are synchronous and do not modify data - they only read /// and return information. The explicit interface implementations allow dynamic invocation while /// maintaining type safety in the implementation. /// public interface IQuery : IQuery where TRequest : class where TResult : class { /// /// Executes the query based on the provided strongly-typed request and returns typed result data. /// /// The request object containing parameters for the query operation. /// The typed query result data. TResult Execute(TRequest request); /// /// Gets the request type for this query. /// /// The type of TRequest. Type IQuery.GetRequestType() => typeof(TRequest); /// /// Adapts the non-generic Execute to the strongly-typed version. /// /// The request object to cast and process. /// The typed result cast to object. object IQuery.Execute(object request) => Execute((TRequest)request); }