Esempio n. 1
0
 /// <summary>
 /// Initializes new instance of <see cref="EntitySchemaQueryExecutor"/> class.
 /// </summary>
 /// <param name="userConnection">User connection to execute query.</param>
 /// <param name="schemaName">Root entity schema.</param>
 public EntitySchemaQueryExecutor(UserConnection userConnection, string schemaName, LogOptions logOptions)
 {
     _userConnection = userConnection ?? throw new ArgumentNullException(nameof(userConnection));
     _schemaName     = schemaName ?? throw new ArgumentNullException(nameof(schemaName));
     _logOptions     = logOptions ?? LogOptions.None;
 }
Esempio n. 2
0
 private static IQueryExecutor CreateExecutor(UserConnection userConnection, string schemaName, LogOptions logOptions = null)
 {
     return(new EntitySchemaQueryExecutor(userConnection, schemaName, logOptions));
 }
Esempio n. 3
0
        /// <summary>
        /// Allows to use LINQ queries with current user connection.
        /// </summary>
        /// <param name="userConnection">UserConnection instance.</param>
        /// <param name="schemaName">Root schema name (i.e. "Contact").</param>
        /// <param name="logOptions">Allows to log query generation process.</param>
        public static EntitySchemaQueryable <DynamicEntity> QuerySchema(this UserConnection userConnection, string schemaName, LogOptions logOptions)
        {
            if (null == userConnection)
            {
                throw new ArgumentNullException(nameof(userConnection));
            }
            if (string.IsNullOrEmpty(schemaName))
            {
                throw new ArgumentNullException(nameof(schemaName));
            }
            if (null == logOptions)
            {
                throw new ArgumentNullException(nameof(logOptions));
            }
            if (null == logOptions.LogAction)
            {
                throw new InvalidOperationException($"LogOptions.LogAction cannot be null.");
            }

            return(new EntitySchemaQueryable <DynamicEntity>(userConnection, schemaName, logOptions));
        }
Esempio n. 4
0
 public EntitySchemaQueryable(UserConnection userConnection, string schemaName, LogOptions logOptions)
     : base(QueryParser.CreateDefault(), CreateExecutor(userConnection, schemaName, logOptions))
 {
 }