Skip to content

Instantly share code, notes, and snippets.

Avatar

Lluis Franco lluisfranco

View GitHub Profile
View Adomd_OLAPMemberNameAttribute.cs
public class OLAPMemberNameAttribute : System.Attribute
{
string _Description = string.Empty;
public OLAPMemberNameAttribute(string description)
{
_Description = description;
}
public string Description { get { return _Description; } }
}
View Adomd_IDataReader_ToList.cs
public static List<T> ToList<T>(this IDataReader dr)
{
var list = new List<T>();
var obj = default(T);
while (dr.Read())
{
obj = Activator.CreateInstance<T>();
foreach (var prop in obj.GetType().GetProperties())
{
var columnDescription = getPropertyDescription(obj, prop.Name);
View Adomd_Query.cs
public static List<T> Query<T>(this AdomdConnection conn, string commandText, params object[] parameters)
{
var commandTextParameters = ReplaceCommandTextParameters(commandText, parameters);
var cmd = new AdomdCommand(commandTextParameters, conn);
var dr = cmd.ExecuteReader();
return dr.ToList<T>();
}
View Adomd_DTO.cs
internal class MyResultDTO
{
[OLAPMemberNameAttribute("[Valuation Dates Accumulated].[Hierarchy].[Year].[MEMBER_CAPTION]")]
public string Year { get; set; }
[OLAPMemberNameAttribute("[Measures].[Gains Period]")]
public decimal? GainsPeriod { get; set; }
[OLAPMemberNameAttribute("[Measures].[Gains YTD]")]
public decimal? GainsYTD { get; set; }
View Adomd_Connect_sample.cs
using (var conn = new AdomdConnection(connectionString))
{
conn.Open();
var commandText = @"SELECT
{
[Measures].[Gains Period],
[Measures].[Gains YTD],
[Measures].[Amount]
} ON COLUMNS,
[Valuation Dates Accumulated].[Hierarchy].[Year].Members ON ROWS
View SFTP_Connect_And_Download_Sample.cs
private static void SFTP_Connect_And_Download_Sample()
{
var host = "sftp_server_address.com";
var port = 999;
var username = "your_username";
var passphrase = "your_passphrase";
var privateKeyLocalFilePath = @"your_localpath\...\PrivateKeyOpenSSH.ppk";
var remoteFolderPath = "/";
var localFolferPath = @"D:\locafiles\";
You can’t perform that action at this time.