I am looking Sharp Architecture alternative which use Entity Framework code first as ORM. Is there any mature project like Sharp Architecture with EF code first ?
Architecture is a blueprint. Once you see Sharp Architecture you should be able to simply think about it and change it to work with EF. If you are not able to do that you probably don't have enough skills with required APIs - that is th first thing you have to change before start dealing with architecture. No architecture will save you from understanding APIs and without understanding them you cannot do a good architecture correctly using features of your APIs.
Architecture should be driven by needs of your application. The approach where you want to bend needs of your application to fulfill some architecture blueprint is terrible wrong. First you have to define what should your architecture solve for you and after that you can ask if there is any blueprint already doing it (and nothing more).
Most of articles and sample architectures are just pushing a lot of patterns without actual need for them. Number of patterns and layers don't make a good architecture. In most cases it just makes the system overachitected and hard to maintain. These samples are mostly for explaining how to implement some patterns.
Bad news there is no exact replacement, Good news its easy to create something your own like I did.
I have been using S#arp for a long time and it is a good Architecture, I developed lots of applications with it but it looks like there is no more movement with that open source project so late last year I decided to move on an recreate something similar using the same principles but with Entity Framework.
Key components such as NHibernate, NHibernate.Validator and Castle Windsor was replaced to use Entity Framework, LINQ to Entites, System.ComponentModel.DataAnnotations and Autofac respectively. The layers remained the same like the Domain, Presentation, Task, Framework and Infrastructure.
On how I created it please have a look at this post on its detailed explanation.
http://www.macaalay.com/2015/10/20/creating-a-solid-architectural-foundation-from-scratch-is-not-really-that-hard/
I also created a code generator which I called Effinator, which generated CRUD operations and basic UI from your database design
Related
Can you please provide me with some tips/guidelines when architecting, designing and implementing a .net framework application, with the requirements given below:
It will be an analytical tool which will retrieve data from files, sql databases and may be cubes. So data layer should be able to handle that. The middleware should be totally independent of the other layers so probably need an IoC container (which one would you recommend)
It will be deployed on the local intranet
The front layer might be WPF application or Silverlight in future (for now, I am concentrating on Silverlight but the point is that it will change)
It should be easy to customise and improve it in the future without changing much of the code as the framework will be deployed for many clients
I need a way to store the configuration information, which will be picked up by the application on application load events to set its feel and look.
I have two months to implement it and looking for as many tips as possible.
SoC for a start
break your application into several assemblies that use IoC (interfaces + implementations):
application model assembly - all other assemblies will reference this one because these classes will be used for inter-communication - they will mostly be just POCOs
presentation assembly - references app model and business services - this one is either WPF or Silverlight in any case use MVVM to make your testing life easier
business services assembly - references app model and data repositories assembly
data repositories - these define repositories that actually get data from the stores
Then I'd create three additional ones:
file data providers
database providers
cube providers
Data repositories would reference all three and use them to provide necessary data.
If configuration becomes very complex with a lot of functionality then you should put it in a separate assembly as well and reference it by business services assembly.
Which MVVM library to use
Since you mentioned time I suppose you'll have hard time catching your deadline. When using MVVM (which I suggested to use) I also suggest you don't use a full blown PRISM (a.k.a. Composite Application Guidance from P&P) but rather go with MVVM Light Toolkit. It will take you less time to get on the bandwagon.
Code generation
In places where appropriate I suggest you use T4 to its full potential. I use it to import stored procedure calls to avoid using magic strings when calling stored procedures (and using their parameters). Check my blog post about it as well.
DAL technology/library
Don't write your own data access code using things like SqlConnection/SqlConnection functionality. There're many data access layer libraries/technologies today that you can use and not reinvent the wheel. If you know nHibernate, then use that. If you know EF, then use that. If you know anything else, use that. Anything that will provide/generate as much code for you as possible that is already tested and debugged.
So it all boils down to:
DRY + YAGNI
a.k.a. Don't repeat yourself and You ain't gonna need it = don't over-engineer you code.
Agile developers are supposed to be lazy
They should develop just as much as it's needed and no more! TDD implicitly provides this process by the red => green => refactor steps.
I would recommend using MVVM and Test Driven Development. The MVVM will give you good separation between the front and middleware, and the TDD will help control the chaos that comes with any nontrivial app development.
Have a look at the Composite Application Guidance from Microsoft's Patterns and Practices group, it may not match what you are doing exactly but will give you some good ideas.
From an architectural standpoint, I highly recommend taking a look at the Microsoft Application Architecture Guide. Since you are already using the Microsoft technology stack, I would consider using Microsoft Unity for IoC. You indicated that your presentation layer might use WPF or Silverlight, so take a look at using Windows Communication Foundation, as you will be somewhat constrained in Silverlight when it comes to communication with your data layer.
I am exploring technologies and libraries before I get started on a new project. One that has really caught my eye is the S#arp Architecture library for ASP.net MVC. However, I have already decide that the bulk of my web application will use Visual Web GUI as the front end, leaving only a small separate customer facing web component that will be developed in ASP.net MVC. Bearing this in mind, based on the experiences of those of you who have a good familiarity with S#harp Architecture, or may have attempted a similar solution using S#harp, are there any issues or gotchas I should be aware of before I begin? I have also had a look at Castle Active Record, and Fluent NHibernate usage as possible options, but find myself leaning towards S#arp.
My most major goal in choosing a library are to get my data access set up using the repository pattern as quickly as possible.
If your main goal is to flesh out a persistence layer quickly then S#arp Architecture is a bit overload IMO. S#arp makes use of Fluent NHibernate so I'd just go with that. FNH's auto mapping conventions should slice a big chunk off your dev time.
I wouldn't say S#arp is a library. It's more of a boilerplate for Domain Driven Design. You should be familiar with Dependency Injection (aka Inversion of Control), Test Driven Development, Rhino Mocks, and NHibernate before you start looking at S#arp (because those are the concepts and technologies used in it). Otherwise the learning curve will be quite steep.
We have implemented a ASP.NET standard project using the S#harp framework without any problems. I would strongly recommend you start coding from the Services layer and leave no logic in your codebehind aspx files. We do also make big efforts to avoid having logic in Controllers as we saw them as codebehinds files and try to put all the system logic in the services.
Just make sure you plug all necesarry in your global asax file and you should have no problem at all. If you are using NHibernate, Fluent, Service Injection and DDD is really easy to make it work with old asp.net web application.
Rather a simple question. But the implications are vast.
Over the last few weeks I've been reading a lot of material about n-tier architecture and it's implementation in the .NET world. The problem is I couldn't find a relevant sample for Winforms with Linq (linq is the way to go for BLL right?).
How did you guys manage to grasp the n-tier concept? Books, articles, relevant samples etc.
UPDATE: I kind of wanted a sample app not just theory. I like to get into the specific implementation and then iterate the principles myself.
It isn't technology specific but this is a very good book about n-tier architecture: Patterns of Enterprise Application Architecture
No, Linq2SQL in the BLL is not the way to go for n-tier architecture. I would use it in the DAL.
I would suggest you start here, and keep reading. It is a simple concept, but there is a lot of literature out there to help understand it.
Try to understand the concepts first, without putting proprietary technologies into the mix. Once you understand the concepts, then think how to use things like Linq2SQL.
There are also about a billion posts on SO about this already, follow this link and cherry-pick the relevant bits from them
Can someone share their experiences with s#arp architecture. we have decided to follow mvp pattern for the project. Is this okay to go with it ? The size of the project is medium. we are going to follow the tdd and ddd.
Can anybody explain how to use this architecture means explain about the layers. we don't have enough time to go through with entire documentation. if anybody expalin particle with small example in short.
please help me out!!!
Thanks,
Milind
The S#arp Architecture combines ASP.NET MVC with other frameworks and tools like
NHibernate 2.0.1
NHibernate.Validator
Fluent NHibernate and
Castle Windsor (IoC).
It also makes use of the T4 templating engine of Visual Studio to create view scaffolds.
So you could also ask yourself whether you would like to use these tools, libraries and frameworks in your project.
Frankly, if you don't have the time to read the S#arp documentation, then building a project on top of it is probably not a good idea.
One could also say the S#arp arch doesn't hide the complexity of each of the above library and framework from you, so you have to be prepared to look into each of these as well.
The S#arp documentation and the enclosing sample app explains the purpose and structure of the different layers quite well.
The S#arp Architecture project home page links to an active discussion group. I suggest you browse the group messages and ask any questions you have there.
S#arp Architecture is a neat combination of some other neat tools, but you really need to take the time to go through the documentation and some examples. The time you spend reading and learning is a lot less than the time you'll spend refactoring and bug-fixing if you don't study.
My company is interested in porting a large business application to .NET. We plan on developing a desktop version and a silverlight version. I mostly researched the CSLA framework (got rocky's book, halfway through already) and found it a bit over-engineered, the data layer side didn't seem so polished either.
Is there any other frameworks that claim to do what CSLA is doing? I'm not talking about ORM tools (e.g L2S, EF, NHibernate.) I'm interested in a framework that supports business rules, easy n-tier architecture, objects are domain driven and not database driven, security on the business objects etc...
I know I can find small frameworks that will do some of the work required (Enterprise Application Block comes to mind) but I'm looking for one that has everything included.
I would be interested in hearing more about why you think CSLA is over-engineered. I have found it to be very feature rich but most of the features just implement standard .NET framework interfaces and so all the plumbing comes free and you definately have to use it.
Your requirements seem to be a great fit for CSLA. Other frameworks (such as ORMs) contain validation/business rules but the major issue is that you are (in most cases) stuck with your data schema. This leads to objects that are not friendly for UI development and force you to know the intricacies of your database.
Here's a good blog post (archived version) courtesy of "Adam on the Net" discussing and comparing the following:
Castle Project
Spring.NET
Enterprise Library
CSLA
If I were you I would either pick Spring.NET or just start building your own framework around ASP.NET MVC and Fluent NHibernate. Then slowly add your own building blocks as and when you need them. Enterprise library blocks are good but heavy according to me and have lot of things that you may not really need.