vendredi 1 juillet 2016

Can I put a table valued function in a DataSourceAttribute?

Microsoft's [DataSource(...)] lets you put in a name of a table as a string to supply data to your unit test. I want to generate data with dynamic sql, and believe the best way to do this would be with a tvf, though I'm open to suggestions. When I try:

[DataSource("System.Data.SqlClient", CONN, "tvf(10)", DataAccessMethod.Sequential]

I get an invalid object name 'tvf(10)' error. I can only assume Microsoft is putting [brackets] around my tvf(10) and totally killing its tvf-ness. Is there a way around this?

Aucun commentaire:

Enregistrer un commentaire