Beispiel #1
0
 public MeasureByWeek(AdomdDataReader reader, string measure)
 {
     var member = reader["[Time].[Week].[Week].[MEMBER_CAPTION]"] as string;
     var weekStr = member.Substring(_weekPrefix);
     Week = DateTime.Parse(weekStr);
     Values = reader.IsDBNull(reader.GetOrdinal(measure)) ? (double?)null : double.Parse(reader[measure].ToString());
 }
        public void Visit(MetadataInfo.DaxMetadata daxMetadata)
        {
            string  ssasVersion = GetSsasVersion();
            Product productInfo = GetProduct(ssasVersion);

            daxMetadata.Version = new MetadataInfo.SsasVersion {
                SSAS_VERSION = ssasVersion,
                CAPTURE_DATE = DateTime.Now,
                PRODUCT_TYPE = productInfo.Type,
                PRODUCT_NAME = productInfo.Name
            };
            AdomdDataReader result = _conn.ExecuteReader("SELECT * FROM $SYSTEM.MDSCHEMA_FUNCTIONS");

            while (result.Read())
            {
                // Filters only DAX functions
                int?origin = GetInt(result, result.GetOrdinal("ORIGIN"));
                if (origin == null)
                {
                    continue;
                }
                if (origin != 3 && origin != 4)
                {
                    continue;
                }

                var SSAS_VERSION         = ssasVersion;
                var FUNCTION_NAME        = GetString(result, result.GetOrdinal("FUNCTION_NAME"));
                var DESCRIPTION          = GetString(result, result.GetOrdinal("DESCRIPTION"));
                var PARAMETER_LIST       = GetString(result, result.GetOrdinal("PARAMETER_LIST"));
                var RETURN_TYPE          = GetInt(result, result.GetOrdinal("RETURN_TYPE"));
                var ORIGIN               = origin;
                var INTERFACE_NAME       = GetString(result, result.GetOrdinal("INTERFACE_NAME"));
                var LIBRARY_NAME         = GetString(result, result.GetOrdinal("LIBRARY_NAME"));
                var DLL_NAME             = GetString(result, result.GetOrdinal("DLL_NAME"));
                var HELP_FILE            = GetString(result, result.GetOrdinal("HELP_FILE"));
                var HELP_CONTEXT         = GetInt(result, result.GetOrdinal("HELP_CONTEXT"));
                var OBJECT               = GetString(result, result.GetOrdinal("OBJECT"));
                var CAPTION              = GetString(result, result.GetOrdinal("CAPTION"));
                var PARAMETERINFO        = GetXmlString(result, result.GetOrdinal("PARAMETERINFO"));
                var DIRECTQUERY_PUSHABLE = (result.FieldCount >= 14 ? GetInt(result, result.GetOrdinal("DIRECTQUERY_PUSHABLE")) : null);

                var function = new MetadataInfo.DaxFunction {
                    SSAS_VERSION         = ssasVersion,
                    FUNCTION_NAME        = GetString(result, result.GetOrdinal("FUNCTION_NAME")),
                    DESCRIPTION          = GetString(result, result.GetOrdinal("DESCRIPTION")),
                    PARAMETER_LIST       = GetString(result, result.GetOrdinal("PARAMETER_LIST")),
                    RETURN_TYPE          = GetInt(result, result.GetOrdinal("RETURN_TYPE")),
                    ORIGIN               = origin,
                    INTERFACE_NAME       = GetString(result, result.GetOrdinal("INTERFACE_NAME")),
                    LIBRARY_NAME         = GetString(result, result.GetOrdinal("LIBRARY_NAME")),
                    DLL_NAME             = GetString(result, result.GetOrdinal("DLL_NAME")),
                    HELP_FILE            = GetString(result, result.GetOrdinal("HELP_FILE")),
                    HELP_CONTEXT         = GetInt(result, result.GetOrdinal("HELP_CONTEXT")),
                    OBJECT               = GetString(result, result.GetOrdinal("OBJECT")),
                    CAPTION              = GetString(result, result.GetOrdinal("CAPTION")),
                    PARAMETERINFO        = GetXmlString(result, result.GetOrdinal("PARAMETERINFO")),
                    DIRECTQUERY_PUSHABLE = (result.FieldCount >= 14 ? GetInt(result, result.GetOrdinal("DIRECTQUERY_PUSHABLE")) : null)
                };
                daxMetadata.DaxFunctions.Add(function);
            }
        }
Beispiel #3
0
 public MeasureByMonth(AdomdDataReader reader, string measure)
 {
     var member = reader["[Time].[Month].[Month].[MEMBER_CAPTION]"] as string;
     Month = DateTime.ParseExact(member, "MMMM yyyy", CultureInfo.InvariantCulture);
     Values = reader.IsDBNull(reader.GetOrdinal(measure)) ? (double?)null : double.Parse(reader[measure].ToString());
 }