Attribute on return value, how ??

S

Soren S. Jorgensen

Hi,

How do you set an attribue on a return value ??

In Microsoft.SqlServer.Server you got SqlFacetAttribute wich I need to use
on my CLR function that should return a SqlString(MAX) - the
SqlFacetAttribute must be set on the static methods return value to do this.

[SqlFunction(Name= "....")]
public static SqlString MyClrFunction(
[SqlFacet(MaxSize = -1)] SqlString ID,
[SqlFacet(MaxSize = -1)] SqlString Name,
)
{
return new SqlString("Some data"};
}

Where do I put the SqlFacetAttribute on my return value ??

In advance, thanx

Soren
 
S

Soren S. Jorgensen

Arrhhh - just forget it, figured it out :)

[SqlFunction(Name= "....")]
[return: SqlFacet(MaxSize = -1)]
public static SqlString MyClrFunction(
[SqlFacet(MaxSize = -1)] SqlString ID,
[SqlFacet(MaxSize = -1)] SqlString Name,
)
{
return new SqlString("Some data"};
}

Soren
 
J

Jon Skeet [C# MVP]

Soren said:
How do you set an attribue on a return value ??

Use [return: SqlFacet(MaxSize=-1)]

Basically it's like "assembly" or "param" attributes.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top