LCOV - code coverage report
Current view: top level - Cqrs/DataStores - SqlDataStoreExtension.cs Hit Total Coverage
Test: doc-coverage.info Lines: 0 2 0.0 %
Date: 2017-07-26

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="cdmdotnet Limited">
       4             : // //   Copyright cdmdotnet Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System;
      10             : using System.Collections;
      11             : using System.Collections.Generic;
      12             : using System.Data.Common;
      13             : using System.Data.Linq;
      14             : using System.Linq;
      15             : using System.Linq.Expressions;
      16             : using cdmdotnet.Logging;
      17             : using Cqrs.Configuration;
      18             : using Cqrs.Entities;
      19             : 
      20             : namespace Cqrs.DataStores
      21             : {
      22             :         public static class SqlDataStoreExtension
      23           0 :         {
      24             :                 /*
      25             :                 public static int DeleteBatch<TEntity>(this Table<TEntity> table, IQueryable<TEntity> entities)
      26             :                         where TEntity : class
      27             :                 {
      28             :                         DbCommand delete = table.GetDeleteBatchCommand<TEntity>(entities);
      29             : 
      30             :                         var parameters =
      31             :                                 from p in delete.Parameters.Cast<DbParameter>()
      32             :                                 select p.Value;
      33             : 
      34             :                         return table.Context.ExecuteCommand(
      35             :                                 delete.CommandText,
      36             :                                 parameters.ToArray());
      37             :                 }
      38             : 
      39             :                 public static int UpdateBatch<TEntity>(this Table<TEntity> table, IQueryable<TEntity> entities, object evaluator)
      40             :                         where TEntity : class
      41             :                 {
      42             :                         DbCommand update = table.GetUpdateBatchCommand<TEntity>(entities, evaluator);
      43             : 
      44             :                         var parameters =
      45             :                                 from p in update.Parameters.Cast<DbParameter>()
      46             :                                 select p.Value;
      47             : 
      48             :                         return table.Context.ExecuteCommand(
      49             :                                 update.CommandText,
      50             :                                 parameters.ToArray());
      51             :                 }
      52             :                 */
      53             : 
      54           0 :                 public static void Truncate<TEntity>(this Table<TEntity> table) where TEntity : class
      55             :                 {
      56             :                         Type rowType = table.GetType().GetGenericArguments()[0];
      57             :                         string tableName = table.Context.Mapping.GetTable(rowType).TableName;
      58             :                         const string sqlCommand = "TRUNCATE TABLE {0}";
      59             :                         table.Context.ExecuteCommand(sqlCommand, tableName);
      60             :                 }
      61             :         }
      62             : }

Generated by: LCOV version 1.10