How to make UDF(user-defined functions) for OLAP(Analysis Services) with VS.NET. -
06-08-2004
, 02:42 PM
To make UFD for Analysis Services you need a COM library. Below is a
paragraph from the "Books on line".
User-defined function libraries should be implemented as COM
components. These libraries can be implemented as in-process servers
(in a .dll) or as local servers (in an .exe). Before loading a
user-defined function library, ensure that the library contains a type
library. Additionally, all of the interfaces defined in the type
library must be derived from IDISPATCH for automation. User-defined
function libraries can be developed in any environment capable of
generating COM components.
Many people including me do not have VS6 installed any more. So I
tried to use VS.NET C# and Interop to create COM server. The code is:
using System;
using System.Runtime.InteropServices;
namespace ASLIB
{
[Guid("XXXX-………")]
public interface IasLib
{
int foo(int i);
}
[Guid("YYYY-………")]
public class InterfaceImplementation : IasLib
{
public int foo(int i);
{
Return(i+1);
}
}
}
File compiled with a command line (BTW how to add compiler options in
VS.NET?) :
csc /target:library /out:aslib.dll aslib.cs
And then type library and registration:
regasm aslib.dll /tlb: aslib.tlb
When attempt is done to load this TLB into say MDX Builder by using
"Register.." button, the following message pop up:
Unable to add library reference C:\.....\foo..tlb.
The operation has failed because of an error in the COM component -
unknown error The system cannot find the file specified.
Did anybody successfully produce UDF in .NET? Is it any suggestions? |