ASP.Net Web API and KnockoutJS [closed] - asp.net

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm developing an ASP Web API project and using KnockoutJS as the client side technology. To the best of my knowledge there are no examples projects or any kind of sources available in internet for these two technologies yet. If someone has used these two technologies for their development, it is great if you can provide some links here (If there are online sources). I am posing this not as a question but to get some online sources about these technologies to one place (Because as I know there are no online sources yet). If someone know any sources about the projects which have used these two technologies in there architecture, it will be a great help for me (Since there are no online sources).
Thank you.

You should checkout upshot.js, Steve Sanderson's library for interfacing with WebAPI REST services. It is designed to complement knockout.js when building single page applications, facilitating communication between the view model (knockout) and the back end (WebAPI).
Here's a relevant SO post:
Where can I find Upshot.js examples and documentation?

I don't really have any links to share, but on the server side WebAPI outputs JSON by default and client/KnockoutJS side you are just consuming JSON. I use jQuery's .getJson() method and update my KO view model with the return data.
Check out John Petersen's blog for some good Web API samples.

Technically, Knockout.js doesn't help with accessing a REST API specifically Knockout with JSON. So, yea it works fine and I've used to with the Web API no problem. There is the Mapping plugin that helps with mapping the data to your view models which may be useful to you: http://knockoutjs.com/documentation/plugins-mapping.html
Backbone.js is meant to work with REST APIs (like Web API) and there is a project that makes Knockout work with Backbone (https://groups.google.com/forum/?fromgroups#!topic/knockoutjs/SAESwAqjfK4). I haven't used it so I don't know if it works well or not.

Related

What is the difference between ashx, asmx, axd + cs(handler), webmethod(in aspx) and async methods in asp.net framework 4.5? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I need to know the technical difference of those files. Which one is the best option?
When and why should we use it?
I need a human answer, not the MSDN links.
.ashx files are used for handling HttpRequests and modifying HttpResponses; you can pretty much make them do whatever you want. I have seen them used for things like serving PDFs and doing server-side processing and then redirecting. See here for more info.
.svc files (which were not mentioned in your question) are part of MS's new Windows Communication Foundation which is for SOA development. WCF supports SOAP, REST and a lot of other cool stuff.
.asmx files are an older means to host SOAP services. They are often accompanied by asmx.cs files (or .vb) which contain the actual methods behind the service. See here for more info. This is a legacy technology and I would recommend using WCF instead in new development.
[WebMethod] attribute is used to denote the methods surfaced in a SOAP service hosted by an asmx. See here for more info.
The .axd extension is used by generated web services used for many different things. (E.g. MVC3 uses axd web services to serve MS specific javascript) I don't think you would ever create an axd file, but I could be wrong... at least I never have. See here for more info.
Which one is the best option?
They are different tools used to solve different problems. When and why you should use each one depends on the job you are trying to accomplish. Lower level handling of your web application's behaviours can be achieved with ashx files. If you want to provide more standardized services, I would recommend using WCF and svc files. Please provide us with more information about the task you are doing so we can help you pick one.

Embed ASP.NET web pages inside PHP based web site [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
we have centralized back office system and we keep all products information,recently our clients asked us to deploy website to them, so they can show their products on their websites , the clients have their own websites which developed on php or java or whatever , they don't like to use Iframe to show their products because of some SEO problems in Iframe, We want to deploy our E-commerce website inside their website,We want to show our website inside HTML tag such as div,we don't like to design and develop new website for any individual client, I am very interested to know your ideas , and any alternative solution.
So instead of focusing on developing a website that is embeddable, I would focus on one of two approaches: 1) Make web services/REST API, 2) Write a Javascript library.
Making a REST API
You can write web services (or a REST API) that a client could use to integrate into their site. This would expose your data/services/features to them. They would have to do a little programming of course to integrate with the services, but it's an option.
Writing a Javascript library
You can write a Javascript library that will dynamically bring in data (calling web services of course that you host) and then you can take that data and place them into divs etc.
The advantage of this is that you can tell the client something like "just drop these 5 lines of code onto your page and it will do the rest." It has a low barrier to entry for a client.

Browser HTML5 turn-based multiplayer game with ASP.NET (MVC 4) reasonable? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
as the title says, I want to develop a browser multiplayer game with HTML5.
The game will be something like "risk", the turn-based strategy game. I decided to develop with HTML5 and the new canvas.
But the problem is on the server side. When I google, I only get answers, where people use "System.io", "node.js" etc. for that.
So my question is:
Is ASP.NET - especially MVC 4 - a bad choice for my purpose? I would like to do that with asp.net, but of course not when there is an easier/more suited option.
Some people say asp.net is not suited for that, it's too complicated and so on.
But I ask you pros out there :D
Would you consider developing a game like that with asp.net mvc 4 or better stick to other solutions with system.io and node.js and other frameworks? (php?)
I hope you can help my out, that stresses me for weeks now :(
Thanks in Advance!
Greetings from Munich
Tornister
Asp.net, especially MVC is well suited to develop an html5 based game.
A turn based game, is not very different from a web based chat. Where you send messages between members via the server.
To design a scalable solution, you got to use the right methods though.
You have various options to communicate between users.
Libraries like SignalR would help. If you do want to do it yourself, the most efficient method is to use a IHttpAsyncHandler and ajax requests. In MVC the equivalend it AsyncController.
Frameworks like node.js are designed to be async, and thus well suited. Php out of the box is not a good choice for such applications as it doesn't support async requests.
To sum it up, asp.net is not a bad choice, but you need to know how to use it. If you are more comfortable with another framework like node.js, then you should choose that one. Familiarity reduces a lot of development time.

What new tricks can an old dog learn? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Back in 2006 I've created a web site using asp.net 2.0. At that time, I had used Web Forms and classic ADO.NET SQL queries to connect to the underlying database. I've also used a fair amount of XSLT.
Today, the site still stands (it has gone through various upgrades but it is still based on Web Forms and simple SQL queries) but I believe it really needs to be upgraded as far as its technological infrastructure is concerned.
What is the next step I should take to move forward? A bit of ajax? JQuery maybe? Rewrite it in asp.net mvc? Replace SQL with typed datasets or even ling to sql? And what is the best way to embrace APIs such as twitter's?
So, can an old dog learn new tricks?
So why do you believe the site's infrastructure needs to be upgraded? If the site is running and performing well after 6 years of load and data, then what factors are causing you to think you need to upgrade it?
Are there features that you want to implement (or users are asking for) that you can't implement with the current infrastructure?
Is maintenance difficult and brittle, and every time you upgrade, you spend weeks fixing bugs introduced?
Are there integrations that you'd like users to be able to do so that they can extend your application's functionality and/or data to their own applications?
Those reasons above could be reasons to upgrade, but I can't really tell you.
But as far as some of your questions about what to upgrade:
a bit of AJAX? It depends on what your current infrastructure looks like, but it's not too hard to introduce and you can isolate it
pretty well with a service layer.
jQuery? Again, it depends on
how your pages are structured. If you have a lot of master page
re-written IDs and very few classes on your DOM elements, using
jQuery right off the bat may be tough as you'll have to figure out
how to get your selectors in line.
Replace SQL with Typed
DataSets? Please don't do that. Honestly, if you go with
Linq-to-SQL or EF, you'll probably take a slight performance hit
compared to using ADO.NET with DataReaders (if that's what you're
using).
Can an old dog learn new tricks? Always. The learning
never stops.
I would just advise not to upgrade just to upgrade. Make sure you have legitimate business reasons for doing so.
Hope this helps. Good luck!
Step 1) figure out what would add value for your users
Step 2) investigate technical solutions to solving those problems
Step 3) learn and build
You could create a persistence layer and learn about entities. This is an extremely useful skill to have. You could do this by using NHibernate. I would also throw in some LINQ to get a great combo. After this i would probably go to the GUI and do some needed features with jQuery

Entity Framework Vs MVC [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am a Asp.net developer and due to new advancements I am confused between MVC and Entity Framework.I would like to know which is the best option to study first EF or MVC
The two are completely different and have different purposes.
MVC (Model View Controller) is a programmatical pattern used for building applications. Microsoft have a a framework called ASP.Net MVC which is their implementation of it for building MVC websites.
Entity Framework (EF) is an ORM (Object Relational Mapping) tool. This is used primarily for simplifying the data access layer of an application. This can be used in conjunction with ASP.Net MVC.
Personally, I would read about ASP.Net MVC first. This is because you can then use any one of several ORMs with it, including NHibernate and Linq2SQL, the latter being very lightweight and a perfect place to start.
I think they "must" works toghether to get the best. Entity framework, you can think of it as a way to access the database (in an object-oriented fashion). While Asp .NET MVC (which let you choose how to handle the model part, so you can easily use EF) is a framework to create a web application; you can think of it as something that will help you create html pages. As I've stated before, you can easily use entity framework as the M part of mvc if you need to interact with a database.
I suggest you to study MVC first because will give more results (they are something that you can see), then EF. However this is a totally subjective thing.
The most "student" approach is to study EF first and then mvc, but in this case you won't see any real result 'till you studied a bit of MVC.
Hope this helps in any way.

Resources