Esempio n. 1
0
        public Configuration AddNamedQuery(string queryIdentifier, Action <NamedQueryDefinitionBuilder> namedQueryDefinition)
        {
            if (queryIdentifier == null)
            {
                throw new ArgumentNullException(nameof(queryIdentifier));
            }

            if (namedQueryDefinition == null)
            {
                throw new ArgumentNullException(nameof(namedQueryDefinition));
            }

            var builder = new NamedQueryDefinitionBuilder();

            namedQueryDefinition(builder);
            NamedQueries.Add(queryIdentifier, builder.Build());
            return(this);
        }
Esempio n. 2
0
        public static Configuration AddNamedQuery(this Configuration configuration, string queryIdentifier, Action <INamedQueryDefinitionBuilder> namedQueryDefinition)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (queryIdentifier == null)
            {
                throw new ArgumentNullException("queryIdentifier");
            }
            if (namedQueryDefinition == null)
            {
                throw new ArgumentNullException("namedQueryDefinition");
            }
            var builder = new NamedQueryDefinitionBuilder();

            namedQueryDefinition(builder);
            configuration.NamedQueries.Add(queryIdentifier, builder.Build());
            return(configuration);
        }