C# dynamic keyword usage in ASP.NET MVC
I'm new to 开发者_StackOverflow中文版.NET 4 and ASP.NET MVC. I heard that in ASP.NET MVC 3, dynamic object can be created on the fly (i.e an entity representing data from SQL Server) and returned for use in views. Can someone point me to an example of how this is done?
Your views in MVC3 have a Model object which is dynamic if your don't specify a type using the @model keyword. But if the object you return from your controller to your view doesn't have the data it won't magically be present in your view.
The closest thing to what i think you mean would be the Microsoft.Data api in WebMatrix where you just make arbitrary sql queries and get a dynamic object returned which contains fields that correspond to the data structure of your database table ...
Rob connery talks about it here
精彩评论