As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm currently studying MCPD at a local college facility and I have formed the bases that my lecturer knows little about his/her subject.
Here's the project we got from another lecturer in the area.
(It's in VS 2010 and via C#)
Create a 3 tier application for facilitators to handle students/
1 (Create a DB) <---- This Is easy enough and actually made sense. Did this without a sweat
2 - Create a DataLayer - This must be a DataService
2.1 Add an .edmx model to your DataService that is generated from the database that you have created in step 1
2.2 Add the following Queryable service Operators:
2.2.1 GetStudent() - Lists all students from the Database
<<<<-- AND 5 MORE Queries here-->>>>
2.3 - Give all Your clients Read rights only to all your entities.
2.4 - Give all your clients read/writes(Yep I quoted from the page) rights to all your service operations and student Entity.
2.5 - Configure your Service1.svc file to work with the System.Data.Services.DataServiceHostFactory
3 - Create a Wpf Application
3.1 Enable the Users to view Students, Qualifications and so forth based on their login.
3.2 Create functionality to allow facilitators to ad new Students using an xml file.
3.3 Must create an Add using xml or Add using text files window.
Now, my disclaimer : I'm absolutely no specialist or anything good. I have 4 years experience in WinForms with databases. So that's some very limited knowledge.
BUT: the limited knowledge I have.. tell me that nr 2. wants a web service or something of the latter and then not use it and rather use a WPF app to communicate to the DB.
Now as I am willing to insult the thought that has gone into this poorly thought out project, I am also willing to accept the fact, should I be wrong or not have understood correctly.
So now, can anyone please explain to me if this project is even feasible or savvy?
If so, I shall gladly accept reasoning and admit my failure.
The description is totally confusing, but my assumption is you're supposed to create a model using EF, then wrap that in a WCF service then have the WPF app communicate with the Web Service.
I don't really see what is wrong here.
Basically you:
create a Database (meh)
create a DataLayer, i.e. a standalone class library containing objects describing every entity in your database (you can possibly use NHibernate/EntityFramework if you want to look cool, or you can simply create objects and define the database queries in separate methods, which just read in Database and returns the objects you defined in your DataLayer, but with details inside)
Create a WPF app which will use this DataLayer as a model, and show a GUI to allow users to browse students (ie. query Database for students, add/edit/delete their details...).
Again, this seems all very basic to me, unless I didn't understand it
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I want to do an application that use a database and can show the information in datagrids, execute commands with buttons and so on. I want to do it inside the lan and outside the lan.
I think that i have two options. Create a desktop application that use wcf to connect with the service to access to the database. The second option is create an aso application, so I can access to the database with any browser through internet.
Are the two options a good solution? What are the pros and cons of wcf and pros and cons of asp.net?
When to use asp.net and when wcf?
When you only have one client and your only need is to access it via LAN and internet then developing an ASP.NET application is less overhead. This because you don’t need to setup an extra service that you need to configure and secure. On the other hand creating a good UI for an ASP.NET application can be much harder than just a WinForm of WPF application (depending on your UI-needs).
But…. What if you’re planning new clients in the future? Maybe a (native) mobile app or another (windows/web) client for a different group of users with different needs? Then a web service give you some advantages…
For example you want to make a new Windows Phone application (in addiction to your web application) for some CRUD operations.
When you write all the database logic and business rules in you web application you can’t use it directly in you Windows Phone. Okay you can maybe you can use the assembly if it is compatible with that .NET framework profile. But what if you want to create an Android application without using Xamarin or something similar. Than you can’t use the assembly’s from you web application and you need to rewrite your logic again… When you had a web service (for example a REST web service) you can call the service for all the database and (shared) business logic. And you don’t need to care about if its working the correct way. As you probably can see maintainability can also be an advantage of a web service because all the logic is centralized in the service.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I have dome some seriously complex projects using the traditional WebForms and Stored procedures. Recently, however, I did a project using MVC and Entity Framework and I liked they way it works with Entity framework. They way its lets you deal with entities in object oriented manner...Its awesome. The project was not very complex. Just about 12 -15 tables.
We all know that WebForms and stored procedures are more mature and hence reliable technologies of doing thing. With my knowledge EF is still evolving. It doesn't even have the very basic "Unique Constraints". Although there are work around for things, It make's me think twice before starting a project with EF.
What I want to ask is, If I want to start another huge and complex project, can I chose to go with MVC & EF ? Is there any risk of hitting a dead end ?
Personally I use EF and MVC for every one of my new projects. I have yet to encounter a drawback. On the contrary, I find MVC far better to work with. With regards to your stored procedures, they are still and always will be more efficient than running TSQL ad-hoc.. just replace your normal ADO.NET code with EF and continue using the stored procedures. As for unique constrains, you still do those in the DB itself. More info here:
Unique constraint in Entity Framework
and here:
Does Entity Framework 5 support unique constraints?
Also, check this link for using stored procs and ad-hoc TSQL queries with EF: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/advanced-entity-framework-scenarios-for-an-mvc-web-application
There is little risk of using EF and MVC for complex projects. If you use EF, you can still call stored procedures or execute dynamic sql queries (not that you should). EF gives you options. There maybe more risk of not using it. Don't forget SO is built with MVC.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm about to build a fairly complex web application from the bottom up, and I want to do it the right way with appropriate design patterns (which I haven't always used in the past) and the latest .Net technologies.
My ambition is to start out with a web application, but make it possible for future mobile apps, and third-party application development and plug-ins.
This leads me to my main conundrum: For the web site (which I'm going to build using the MVC pattern) should I use WCF to expose my data model as an API, or should I simply reference my data through a dll (or a separate project in the web application solution)?
Let me back it up and give you some of my other design thoughts, so you know what I'm trying to do, and please come with input and suggestions if any of this seem like the wrong approach:
I want to build my data model using EF and the code-first approach, using design patterns such as Unit of work and Repositories.
I want to expose my data model (1) through an API using WCF.
I want to build a web application using TDD and MVC, where I get my data from my data model (1).
So, given the above, it seems like an additional hassle to have the web application use the WCF API when I can easily access the data model elsewise, simply by referencing it in my web application. In addition, the latter seems easier since I would have immediate access to all the objects in my data model. I can't see how that would be possible using web services? The reason I would want to use a WCF API is that I've heard so much praise for the idea of only exposing your data through an API, no exceptions, in order to truly be able to develop for multiple platforms. What other reasons are there? Can I use anything but Http messages for the WCF? Can I expose objects, and, if so, how?
I feel like a lot of the answers I'm seeking can be found on-line, but I've spent a lot of time looking at the separate pieces of the puzzle and still have a hard time connecting them all to fit together. I hope you guys can help, and that this is a question that can benefit others as well.
As I said, I want to do this the right way, so your input (at any stage of the design phase) is very appreciated.
Thanks!
I'd say build a data API using the new WebAPI framework. That way, anything that can consume a RESTful interface via HTTP can connect to it: http://www.asp.net/web-api
Also, you can set up your project so your Data Model is referenced from a separate project so you don't necessarily have to go over the network in your main web application. The WebAPI project can be separate, but use the common model to make sure things are consistent
Take a look at WCF Data Services (DataService) and WCF RIA Services (DomainService)....which can expose your Entity Model as a service.
http://jack.ukleja.com/wcf-data-services-vs-wcf-ria-services/
This guide can help you decide on how to architect your tiers/layers.
http://apparchguide.codeplex.com/
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I believe in the advantages of separating the query side from the command side. For the query side, we can provide the needed information in the most optimized form for the client; which makes it fast and easy. In my case, I use a very simple implementation of the query side, which basically means I want to to use the same database as the one used for the command side.
My question is about how I can implement the query side, and this is what I was thinking:
1/ My first thought was to use a WCF data service, based on an entity framework model that is generated on database views. I would then create specific views for specific UI's. One view can then merge data from various tables. But this seems very limited, because you can't pass parameters to views, and for most queries I need to pass parameters of course.
2/ A WCF data service, based on an entity framework model that is generated on database tables. But then, the query model would be the same as the one used for the command side. And you don't get back the information in the way that is best suitable for the specific UI.
3/ A WCF data service, based on an entity framework model that is generated on database stored procedures. But then there's extra work to expose them; and calling them is also a bit strange (magic strings).
In order to help me to make a decision, I would love to hear your comments to see what would be the best way of exposing my query side. Thanks!
I'd go with option 1. Create fully de-normalised views for the specific queries your application will be making.
When you say you can't pass parameters to views what do you mean? Why can't you run a regular query against the views?
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm looking for a 'complete' solution for code-generation based on DDD or model first approach. Ideally, this would be a separate application or VS plugin that we could use and re-use to generate as much of the standard plumbing code as possible, preserving my custom business logic as well.
I would like to generate VS projects, including WCF sercvice app, Data layer, entity model etc. and client applications such as ASP.MVC (and/or web-forms) sites with scaffolding, windows client.
I know there are many choices like Entity Framework vs NHibernate, open-source frameworks such as S#ahrp Architecture, and there are commercial products as well. I'm open to anything as I know most of the investment will be in time.
Update:
To add to this: The Entity Framework (4.0) is a big step forward as it will generate c# business classes as well as the database schema, allowing you to focus on the 'model', which is good. Is there anything that will go one level higher to allow generation of other objects based on a (meta)model of some kind.
I'd recommend taking a look at CodeSmith. It comes with several different template frameworks like PLINQO (Linq-to-SQL), NHibernate, CSLA and .netTiers (which sounds closer to what you are looking for).
Also take a look at the video tutorials on how to use the frameworks located here.
Thanks
-Blake Niemyjski
I understand that SparxEA (Enterprise Architect) supports code generation (and the generation of models from code) but I've never actually done that with it myself.
So this should definately allow you to model your system / domain and then generate appropriate code.
It also seems to support integration with Visual Studio: http://www.sparxsystems.com.au/products/mdg/int/vs/index.html