Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
473 views
in Technique[技术] by (71.8m points)

c# - Using built-in sql functions in a LINQ query?

Is it possible to use buillt-in sql functions like user_name() in a LINQ query? If not, can I use something else?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It depends on the provider. For example, in LINQ to Entities against SQL Server you can use SqlFunctions - which has a UserName method which corresponds to USER_NAME() in Transact-SQL. (There are many other methods and properties. For the current user, you can just use the CurrentUser property, for example.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...