Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling SQL Server function without EDMX
Message
De
30/12/2014 12:20:51
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01612850
Message ID:
01612853
Vues:
45
Depending on the version of EF, you can call a stored proc, which can call the function.




>Hi everybody,
>
>I'm wondering if there is a way to use SQL Server function (in particular, we have function that calculates age based on the birthday) without using EDMX?
>
>I checked this link http://msdn.microsoft.com/en-us/library/vstudio/dd456847(v=vs.100).aspx but wondering if there is any other way.
>
>This is what I started to write:
>
>
>  var query = db.Guests.Select(g => new GuestsList
>            {
>                LastName = g.LastName,
>                FirstName = g.FirstName,
>                BirthDate = g.BirthDate,
>                Phone = g.Address.AreaCode.Trim() + g.Address.Phone.Trim()
>               
>            });
>
>We have a SQL Server function dbo.siriusfn_AgeToday(g.birth_date) which I'd like to include into this query.
>
>Thanks a lot in advance.
>
>UPDATE. Looks like it's not supported in Code First :( http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/1953237-code-first-support-for-user-defined-functions-udf
>
>I added 3 votes.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform