Question:
In a asp.net application I want to keep some config sections encrypted. How do I do this?
The cost of immutability
4 days ago
Blog about things I found on the web or made up and like to put somewhere if not in mind.
select top 5 (total_logical_reads/execution_count) as avg_logical_reads, (total_logical_writes/execution_count) as avg_logical_writes, (total_physical_reads/execution_count) as avg_physical_reads, Execution_count, statement_start_offset, p.query_plan, q.text from sys.dm_exec_query_stats cross apply sys.dm_exec_query_plan(plan_handle) p cross apply sys.dm_exec_sql_text(plan_handle) as q order by (total_logical_reads + total_logical_writes)/execution_count Desc
using System;
using System.Reflection;
namespace TestUtilities
{
public class TestHelper
{
public static object InvokeStaticMethod(System.Type type, string methodName, object[] parameters)
{
BindingFlags bindFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
return InvokeMethod(type, methodName, null, parameters, bindFlags);
}
public static object InvokeInstanceMethod(System.Type type, object instance, string methodName, object[] parameters)
{
BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
return InvokeMethod(type, methodName, instance, parameters, bindFlags);
}
private static object InvokeMethod(System.Type type, string methodName, object instance, object[] parameters, BindingFlags bindFlags)
{
MethodInfo methInfo;
methInfo = type.GetMethod(methodName, bindFlags);
if (methInfo == null)
{
throw new ArgumentException(String.Format("There is no method with name {0} on type {1}", methodName, type.Name));
}
object result = methInfo.Invoke(instance, parameters);
return result;
}
}
}
SELECT CAST( CONVERT( CHAR(8), GetDate(), 112) AS DATETIME)
SELECT CAST( FLOOR( CAST( GETDATE() AS FLOAT ) ) AS DATETIME )
SELECT DATEADD(d, 0, DATEDIFF(d, 0, GETDATE()))
SET DATEFORMAT dmy
SET STATISTICS IO ON
SET STATISTICS TIME ON
select myDateTime
from #dummy
where CAST( FLOOR( CAST( myDateTime AS FLOAT ) ) AS DATETIME ) = '02/07/2007'
SET STATISTICS TIME OFF
SET STATISTICS IO OFF