Rails Console is so useful for direct sanity-checking of your model. Is there an ASP.NET MVC equivalent?
Is it possible to mimic Rails Console behaviour using LinqPAD?
Rails Console is so useful for direct sanity-checking of your model. Is there an ASP.NET MVC equivalent?
Is it possible to mimic Rails Console behaviour using LinqPAD?
Not really, since you're not inside the running application in the same way as with the Rails Console. - As Lloyd shows in his answer, it seems to be very much possible. Still seems that it's easier to use the Immediate Window if it is sufficient for what you are trying to achieve.
LINQPad is great anyway and I use it similarly to how I use the Ruby Interactive Ruby Shell (IRB).
The Immediate Window in the Visual Studio debugger can get you close to the same experience as the Rails Console gives. I hope that C# 5.0 will get us even closer because as of now you can't use lambda expressions and such.
awesome - I discovered LinqPAD 4.38.03 (latest beta version) works perfectly well as a Rails Console substitute!
My ASP.NET MVC3 project is based on Entity Framework 4.2 (using the "database first" approach) which Linqpad integrates nicely with. I am able to reference my assembly as a connection and query the model, controller, repositories etc. interactively, just like in Rails Console!
These were my steps
Finally, in your query window select your new assembly connection as the "Database" and that's it! You can now work with your assembly interactively.
For example, to inspect and test a controller: (first, in Query Properties, add a reference to System.Web.Mvc
)
var controller = MyProject.Controllers.CustomerController();
controller.Index().Dump();
to "post" some data
var customer = new Customer() {name = "Brian"};
controller.Create(customer);
to see your new Customer in the database
Customers.Dump();
or if you have a repository
var repo = new Repository();
repo.GetCustomers().Dump();