コード例 #1
0
        /// <summary>
        /// Find an item stored by identifier
        /// </summary>
        /// <param name="storage">Storage object</param>
        /// <param name="identifier">Item identifier</param>
        /// <param name="projection">Data projection</param>
        /// <returns>Instance of <typeparamref name="TSelect"/>, or null when not found</returns>
        public static TSelect Find <TDataModel, TSelect>(this IFindableStorageWithSelector <TDataModel> storage, object identifier, IDataProjection <TDataModel, TSelect> projection)
            where TDataModel : IIdentifiable
        {
            Checker.NotNullArgument(storage, nameof(storage));
            Checker.NotNullArgument(identifier, nameof(identifier));
            Checker.NotNullArgument(projection, nameof(projection));

            return(storage.Find(new object[] { identifier }, projection));
        }
コード例 #2
0
        /// <summary>
        /// Find an item stored by a data instance
        /// </summary>
        /// <param name="storage">Storage object</param>
        /// <param name="data">Data item</param>
        /// <param name="projection">Data projection</param>
        /// <returns>Instance of <typeparamref name="TSelect"/>, or null when not found</returns>
        public static TSelect Find <TDataModel, TSelect>(this IFindableStorageWithSelector <TDataModel> storage, TDataModel data, IDataProjection <TDataModel, TSelect> projection)
            where TDataModel : IIdentifiable
        {
            Checker.NotNullArgument(storage, nameof(storage));
            Checker.NotNullArgument(data, nameof(data));
            Checker.NotNullArgument(projection, nameof(projection));

            return(storage.Find(data.Identifiers, projection));
        }