/// <summary> /// Create a new instance of the <Typ>LearningStoreQuery</Typ> class /// </summary> /// <returns>A new <Typ>LearningStoreQuery</Typ></returns> /// <param name="viewName">Name of the view for the query. If this is an item type name, /// then the default view for the item type is used.</param> /// <exception cref="ArgumentNullException"><paramref name="viewName"/> is a null reference.</exception> /// <exception cref="InvalidOperationException">The store was created /// by a different version of this product, the schema information stored /// inside the database is invalid, or <paramref name="viewName"/> /// does not refer to a view or item type in the store.</exception> /// <exception cref="SqlException">The database could not be /// opened or other SQL error.</exception> /// <remarks> /// See the <Typ>LearningStoreQuery</Typ> documentation for more information /// about constructing queries. /// </remarks> /// <example>The following code opens a store and creates a new query: /// <code language="C#"> /// LearningStore store = new LearningStore("Server=Learning;Database=Mls;Integrated Security=true", "Bob"); /// LearningStoreQuery query = store.CreateQuery("AttemptItem"); /// </code> /// </example> public LearningStoreQuery CreateQuery(string viewName) { // Check parameters if (viewName == null) { throw new ArgumentNullException("viewName"); } // Get the information about the item LearningStoreSchema schema = GetSchema(); LearningStoreView view = null; if (!schema.TryGetViewByName(viewName, out view)) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, LearningStoreStrings.ViewNotFoundInSchema, viewName)); } return(new LearningStoreQuery(this, view, m_locale)); }
/// <summary> /// Initializes a new instance of the <Typ>LearningStoreQuerySort</Typ> class. /// </summary> /// <param name="store">Store on which the query is created on.</param> /// <param name="view">View for the query.</param> /// <param name="locale">Locale used for conversion to/from strings.</param> internal LearningStoreQuery(LearningStore store, LearningStoreView view, CultureInfo locale) { // Check parameters if (store == null) { throw new LearningComponentsInternalException("LSTR2230"); } if (view == null) { throw new LearningComponentsInternalException("LSTR2240"); } if (locale == null) { throw new LearningComponentsInternalException("LSTR2250"); } // Save the simple info m_store = store; m_view = view; m_locale = locale; }