示例#1
0
        /// <summary>
        /// Find an item stored by identifier
        /// </summary>
        /// <param name="storage">Storage object</param>
        /// <param name="identifier">Item identifier</param>
        /// <param name="includes">Linked data to include</param>
        /// <returns>Instance of <see cref="TDataModel"/>, or null when not found</returns>
        public static TDataModel Find <TDataModel>(this IFindableStorage <TDataModel> storage, object identifier, IDataIncludes includes = null)
            where TDataModel : IIdentifiable
        {
            Checker.NotNullArgument(storage, nameof(storage));
            Checker.NotNullArgument(identifier, nameof(identifier));

            return(storage.Find(new object[] { identifier }, includes));
        }
示例#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="includes">Linked data to include</param>
        /// <returns>Instance of <see cref="TDataModel"/>, or null when not found</returns>
        public static TDataModel Find <TDataModel>(this IFindableStorage <TDataModel> storage, TDataModel data, IDataIncludes includes = null)
            where TDataModel : IIdentifiable
        {
            Checker.NotNullArgument(storage, nameof(storage));
            Checker.NotNullArgument(data, nameof(data));

            return(storage.Find(data.Identifiers, includes));
        }
示例#3
0
 public HomeController(ILogger <HomeController> logger,
                       IStoreReader <Student> studentStore,
                       IFindableStorage <Student> findableStorage,
                       IFindableStorage <SchoolContext, Student> findableStorage2,
                       ISearchableStorage <Student> searchableStorage,
                       ISearchableStorage <SchoolContext, Student> searchableStorage2,
                       ILazy <IStoreReader <Student> > studentStoreLoader,
                       IStoreReader <Enrollment> enrollmentStore,
                       IBulkCreatableStorage <Log> bulkCreatableStorage)
 {
     _logger               = logger;
     _studentStore         = studentStore;
     _findableStorage      = findableStorage;
     _findableStorage2     = findableStorage2;
     _searchableStorage    = searchableStorage;
     _searchableStorage2   = searchableStorage2;
     _studentStoreLoader   = studentStoreLoader;
     _enrollmentStore      = enrollmentStore;
     _bulkCreatableStorage = bulkCreatableStorage;
 }