I'm trying to find some best-practice examples (or any examples, actually) of using Machine.Specifications with the ASP.Net Entity Framework in an MVC project.
Not having had much experience with Machine.Specifications, I'm keen to see what sort of tests other people find useful and whether there are any gotchas for using the EF-generated objects instead of custom-built ones.
Pointers, suggestions and examples much appreciated.
This is the blog post that got me started using machine.spec, http://blog.wekeroad.com/blog/make-bdd-your-bff-2/
Rob, goes through the complete setup, from installation to writing specs. It doesn't use EF, but it should still get you headed in the right direction. I used SubSonic in my learning project.
Related
I am hoping this doesn't get flagged as subjective since everyone's idea of "good" can be different. However, I know that you know what I mean, so, instead of flagging this question, feel free to edit the subject if you think it could be presented in a more objective manner. This is also not a duplicate of a good tutorial for .Net development with MVC, spring.net and NHibernate.
I come from WebForms and need to learn MVC. I came upon this tutorial on MSDN which has been great for understanding the basics of the MVC design pattern. However, it's just enough to teach someone the bare minimum so that they have everything they need to know to build a rudimentary ASP.NET MVC application. From what I've seen, the methods illustrated there aren't exactly what I'd put in a professional, enterprise solution which is exactly what I am about to start working on. I'd like to jump straight from the basics to advanced development, so I am interested in a tutorial/guide that has achieved popularity for being a solid resource for MVC development and best practices.
I realize that this question could have multiple answers, only one of which can be selected. However, there's still the upvote system, so answerers can still get points and the upvotes will still serve as indicators for helpful answers which is really what SE is all about.
I think a good starting point, it would be to check the www.asp.net site. it's certainly a good place to start. There would you find many tutorials for your purpose.
Furthermore, if you are about to buy a book, check PRO ASP.NET MVC 4 by Adam Freeman, http://www.amazon.com/Pro-ASP-NET-MVC-Adam-Freeman/dp/1430242361/ref=sr_1_1?ie=UTF8&qid=1387461608&sr=8-1&keywords=Pro+ASP.NET+MVC.
It's really a masterpiece.
It's been a while since I've looked at it, but NerdDinner helped me out when I was getting started -
http://nerddinner.codeplex.com/
http://nerddinner.com/
I'd like to jump straight from the basics to advanced development, so I am interested in a tutorial/guide that has achieved popularity for being a solid resource for MVC development and best practices.
In my opinion, using a framework in enterprise level requires deep knowledge of every part of it. why a component/class is designed, what is the purpose of it, how do we use it, what's the best practice, etc.
In this way I have found the Programming Microsoft ASP.NET MVC by Dino Esposito very helpful. The book's aim is to explain the mechanics of the framework and effective ways to use it.
My searches are not surfacing anything. Does anyone know of a good sample MVC application that uses the NCommon framework? We are looking for a good framework that will support either EF 4 or NHibernate 3. NCommon appears to fit the bill in that regard, but the project is sorely lacking any good code samples.
I gave up on NCommon over a year ago. I was not able to get the project owner to address a very simple pull request. In fact it's still open. It's not really very hard to roll your own UnitOfWork implementation. Domain events are even easier to roll your own.
If you really want to take a dependency on a stack, you might look at Sharp Arcihtecture instead.
I'm in two minds at the moment in terms of adopting a persistence framework for CRUD operation (for MySQL) with JSF 2. I've googled and read comments from pro-JPA vs pro-JDO groups but I still can't decide what to adopt.
Is there any good step-by-step tutorials (similar to those provided at balusc.blogspot.com) of JPA implementations (Hibernate, etc) and JDO implementations (DataNucleas, etc) available online? Perhaps going through these examples might help me to understand a bit more about these two Java specifications and decide which to adopt finally.
I'm a newbie when it comes to JPA and JDO implementations so please be kind in your responses -:)...
P.S: Please no reference to roseindia.net. Sorry, that site is just too crappy for me!...
Here is the link with maven archetype that should get you up to speed really fast.
http://www.andygibson.net/blog/projects/knappsack/
I suggest trying to use this one:
jee6-servlet-minimal-archetype
It gets you CDI+2.0+JPA
I’m new to asp.net and the mvc framework and I’m trying to learn by using the asp.net learn tutorials for Building a Contact Management Application in vb (http://www.asp.net/learn/mvc/tutorial-29-vb.aspx).
The question I have is that I would like to begin a new project to start using mvc, but how do I start….
The tutorials start by putting data access and logic into controllers at first and then making the application loosely coupled by refactoring the code.
Is this the way to approach a new project or should I be making the application loosely coupled from the start?
I have followed the next iterations of the tutorials about TDD but couldn’t get my head around that just yet and wanted to really focus on cementing what I’ve picked up so far.
Any help or advice would be great.
I would probably check out the NerdDinner sample app and eBook. It provides some pretty good direction on the best way to do things. Link Here
Id recommend jumping straight into the sharp architecture stuff.
http://www.sharparchitecture.net/
Rob Conery has a good series of walkthroughs in regards to creating an asp.net mvc storefront application. I think they include TD stuff, but are done in C#. Here is the link.
I don't mean to scare you but I wasn't really productive until my 4th project.
Sure, I managed to hack out a few sites but if anyone looked at the code I wouldn't own up to it! :)
Nerd Dinner is certainly the place to start. I also found this site to be one of the most useful.
The trick I found was to, once Nerd Dinner was out the way, pick a pet project and get into it. Then, I picked another pet project and corrected the mistakes I made in the previous one. The 4th project actually resembled a well written site.
It's just because the paradigm for writing sites in mvc is so different that there is a pretty big learning curve. At least that's been our experiance here.
I also recommend S#arp all the time. I was novice to IoC, NHibernate, and MVC when I started, and S#arp was a big help. As for VB, S#arp can be used as binary assemblies; however this surely won't be as easy.
For VB/C# look here: https://stackoverflow.com/questions/1653895/should-i-learn-vb-net-or-c. I personally rarely answer VB questions, and I find C# lambda very helpful, so I can confirm many points there.
But if you only need to learn MVC, not to start real project, NerdDinner will do. Just don't take it as real-world best practices; it's to teach MVC stuff/features, not how to write well-designed and maintenable programs.
The question is in the title.
It doesn't favor one over the other at all. It's just common to use LINQ to SQL examples because they are simpler to setup and deploy, so it's easier to digest the sample code without getting distracted by something which deserves its own learning path.
I agree that it does not favor one over the other. I always assumed that Linq to SQL tended to be used in examples because it was released about a year earlier. Therefore, book writers were more familiar with Linq to SQL and/or felt it was more stable.
I agree with Rex in that it makes more sense, when giving a tutorial about ASP.NET MVC, to keep other technology decisions simple. Since either DAL implementation can be used, it is easiest to teach MVC by using Linq to SQL (the simpler of the two). Linq to SQL is also widely considered to be more light-weight.
I must admit, it would be nice to have more open-source examples of projects using ASP.NET MVC along with Entity Framework. I can tell you that it works fine, because I am using it on one project. However, it can be a bit more difficult to figure out some of the ideosyncrasies. Here is another question that shows some links to examples.
I think this tendency to use the path of least resistance in example is a diservice to new developers. How many times have you seen an example, with the caveat that it is not production worthy code, with no reason as to why it is not appropriate, or good direction on how to find what is best? Personally, I appreciate longer examples that actually lead me to discover how something should be used are more helpful.
In this particular case, using Linq to Entities would be much more useful, as it is seemingly the future.
In my opinion, it doesn't favor it. It's what you see in most examples, because Linq to Sql is the fastest way to get examples up and running. Rails follows the same convention of many examples using features (scaffolding for example) that you would rarely see used in a production site.
As all the other posters have said - L2S samples are just a lot easier to put together hence you'll see them quoted more. In reality your MVC models may not use L2S directly - they could be hooking up to a separate services tier or some data transfer objects exposed by another system entirely.