none
UDF not showing in datacontext RRS feed

  • Question

  • Hi,

     

    After adding a UDF to my database (simple function which returns a bit / boolean) and adding it to the methods pane of a dbml file it seems to get lost somehow. If I create a new datacontext object I can see all other SP's (default aspnet procs) but my own user defined function is nowhere to be seen.

     

    I already tried rebuilding, readding the UDF to the methods pane, refreshing all references... nothing seems to work. As far as I know I should be able to call the udf as a function on a datacontext object, right?

     

    What could I be doing wrong?

    Saturday, June 28, 2008 3:18 PM

Answers

  • I'm afraid I cannot reproduce the behavior you are reporting...I copied your SQL function (after creating a CrewOnProduction table) and used the O/R Designer; it appears to do the right thing.

     

    Is this the only UDF that exhibits the problem? Do you have other SQL functions or procedures where you see the same issue?

     

    Are you using the .NET 3.5 RTM (Visual Studio 2008) version or the SP1 Beta?

     

    Thanks,

     

    --Samir

     

     

    Monday, June 30, 2008 10:46 PM

All replies

  • What does the UDF look like? If you don't wish to share the exact SQL code, can you give me an idea of what the code does? (Does it use temp tables?)

     

    Thanks,

    --Samir

     

     

    Monday, June 30, 2008 5:15 PM
  • Here's the code:

     

    Code Snippet

    ALTER FUNCTION [dbo].[udf_CrewInProduction]

    (

    -- Add the parameters for the function here

    @productionID uniqueidentifier,

    @userID uniqueidentifier

    )

    RETURNS bit

    AS

    BEGIN

    DECLARE @Result bit;

    DECLARE @RecordCount int;

    SET @RecordCount = 0;

    -- Insert statements for procedure here

    IF EXISTS(SELECT * FROM CrewOnProduction WHERE

    ProductionID = @productionID AND

    UserID = @userID)

    SET @Result = 1;

    ELSE

    SET @Result = 0;

    RETURN @Result

    END

     

     

    Not that difficult / weird I would say.
    Monday, June 30, 2008 5:36 PM
  • I'm afraid I cannot reproduce the behavior you are reporting...I copied your SQL function (after creating a CrewOnProduction table) and used the O/R Designer; it appears to do the right thing.

     

    Is this the only UDF that exhibits the problem? Do you have other SQL functions or procedures where you see the same issue?

     

    Are you using the .NET 3.5 RTM (Visual Studio 2008) version or the SP1 Beta?

     

    Thanks,

     

    --Samir

     

     

    Monday, June 30, 2008 10:46 PM
  • Hi Samir,

     

    You might not believe me (and I'll understand), but I just started VS again to try once more and suddenly it's all working fine. I have no clue what I might have done to fix this, but I don't really care as long as it's working Smile

     


    Thanks for the help though!

     

    PS: Using SP1 Beta!

    Tuesday, July 1, 2008 6:06 PM