I was looking at Breeze.js and was interested in using it with services that we have in production. The services are already working and cannot be changed.
The question I had was if it is possible for Breeze.js to make PUT calls when saving data? If so, are there any examples showing how?
We are working on providing more documentation for this, please stay tuned.
Related
My website is up and running with support from Wix.com, I used the drag and drop builder to set it up and I didn't need to do any Client side/Server side programming for it to work.
What should I do if I want to keep the app updated with the website as soon as I upload any article/post on the website.
Consider taking a different approach and migrate to a platform/architecture that better suits your specific case.
My suggestion would be Microweber - it's a pretty advanced platform for websites with CMS and e-commerce features. It's been around for quite some time (3 years or so) and I'm using it for about 12 live active projects.
It's very neat if you plan to write custom code as it's based on Laravel and everything is easily extendable.
However, I'm using it mainly because of the support. Although it's free and open-source the team is online most of the time and have replied to my every request so far.
This is critical for me as many website solutions come and go and none is
perfect. What makes this one better is the reaction time and adequacy.
This is my personal opinion with regard to the fact that it's very hard to pick one solution among so many given that you didn't state more specific requirements.
It cannot be done without any server side scripting and backend database for the mobile app. you need to develop database for it.and then you will need to develop web service for the passing the data between mobile and backend.
A dirty way to do this would be through an HTTP request that reads HTML. However the best way would be through Wix's REST API.
Edit: I'm regards to keeping the app updated, you're going to need a backend service that is consistently checking for updates.
I'm looking for a starting point on how to extend BreezeJS (or if it's even possible!) to support sending JSON data using the Badgerfish notation to the server from BreezeJS.
I see that BreezeJS has the JsonResultsAdapter - to take a response from the server and transform it - which would work to allow Breeze to walk through a Badgerfish JSON result set and instantiate entities.
I need the other way - a JsonRequestAdapter (or something like it) - to take the JSON that Breeze has created and about to send to the server, and modify to the Badgerfish notation.
Any guidance for this problem? thanks!
Update: June 2013
I've gone with the approach of implementing a custom Breeze DataService adapter that I pass into an EntityManager instance. This approach is not for the faint of heart to be honest, and took some work to really understand what needed to happen. I took the provided Web API DataService adapter and 'adapted' it to work for a generic RESTful service.
Adam, this is a great question.
We are trying to come up with a standard mechanism analagous to the 'JsonResultsAdapter' to be used to intecept http 'puts' but really want to understand the most common use cases first. We'd love any feedback on suggestions and use cases.
Please add a 'feature request' for this to the Breeze User Voice. We take these suggestions very seriously and this is a topic that we think is important as well, but really want to get some feedback from our community on its priority.
This may sound like a dumb question on the surface, but why does the Hot Towel SPA Template include Breeze at all?
I've been spending the last few days learning Hot Towel and its dependencies, and as far as I can tell, nothing in the template actually uses Breeze. Perhaps that is going to change with some future release?
Sure, Breeze is a good library. But it's bound to CRUD methodology and requires you design your ApiControllers a particular way. (Metadata, SaveChanges, etc.) see here
It also guides you to Entity Framework. While this is more of a soft-dependency, since Breeze also shows a sample without it, it still guides you down a similar pattern of implementation using a modified repository pattern.
If you are using a NoSQL datastore, or CQRS patterns instead of CRUD, then Breeze becomes very difficult to use. There are alternative libraries for data access that work well in this style, such as AmplifyJS.
But the rest of Hot Towel is excellent! I especially like Durandal. So the question begs, if the template isn't actually doing any data access - why include any data access component at all? It would be better to ship it without Breeze, and if the end-user wants to use Breeze, or Amplify, or whatever - then so be it. The rest of Hot Towel would continue to shine as a great SPA implementation.
Matt - Good question. Since I created it I guess I should answer :)
When I built the template I had a focus on providing enough to get folks going with the right tools, and just enough starter code to guide the way. I did not want anyone ripping out code. I'm not a fan of templates that start you down a path and make you remove tons of files and code and change direction. Those are samples.
Samples are good. In fact, samples can be excellent (like the other templates, which I feel are more like samples). Those serve another purpose: to show how you can do things.
Back to the Hot Towel template ...if I include code that uses Breeze, I would be tempted to add a datacontext.js and a model.js on the client. They would contain data access code and code to extend the models on the client. Then I would be tempted to add a controller, some server side models, an ORM and a database. Once there, I'd want to use the data in multiple screens, which leads me to more Knockout and caching with Breeze. Then I might be tempted to add editing, which would lead to change tracking. Soon I have a full blown app. Or more conservatively, I have a sample again. While these approaches would provide more guidance on how to put these together, they would not help you "get started" with a template where you can just start building and adding your own code. If I stop short of some of these features, it's still walking down a road that requires you to change how I did it.
As it stands today, HotTowel is pretty darn close to a template in the truest sense. You create a new project and you are off and adding your own code.
You could argue (and you may be) that Breeze shouldn't be in there since I don't use it in the template. Nor do I use moment.js, BTW. However, I argue that they are both excellent libraries that I would not want to build a CRUD based SPA without them. Breeze is flexible, as you suggest, so you don't have to walk a specific path.
The best way to understand the value of Breeze is to build an app that has its features but without Breeze. Then you can see how much code that takes and how involved it is. For one such example, see my intermediate level SPA course at Pluralsight where I do exactly this: http://jpapa.me/spaps
So you ask "why Breeze?" ... because I strongly recommend it for building a SPA.
Thanks for asking and good luck !
Thanks for asking the question.
John, as author of HT, has offered an answer. I, as a principal of the Breeze project, am inclined to agree with him :)
HotTowel generates a foundation for you to build upon. It is not the building itself.
It is a foundation intended for a specific kind of application, a CRUD application based on a specific set of cooperating JavaScript and ASP.NET technologies. Breeze is a contributor ... but not the only one. Knockout, with its MVVM design and 2-way data binding, is particularly well-suited to the data-entry tasks typical of CRUD apps.
Of course there are other kinds of SPAs. There's an important class of apps that mostly present information and accept little user input. Such apps don't benefit as much from data binding and the people who write them can get pretty hostile about data binding in general and KO in particular.
My point is that HT targets a particular class of application ... one that happens to be immensely successful at least when measured by sustained popularity. It delivers the goods for people who build those apps. It may not be the right starting place for other kinds of apps.
It is true that the easy road to Breeze runs through Web API, EF, and a relational database. Take those away, and you may writing more code on the server (and a little more on the client). That may be the perfect trade-off for you.
The authors of Breeze would like to make that path easier. I don't think BreezeJS makes it harder. I don't understand your statement "Breeze becomes very difficult to use." Have you tried it?
Your client can communicate with any HTTP resource in any manner you chose. It is pretty easy to use existing Web API controllers (albeit easier with Breeze Web API controllers). You can use amplify.js if you prefer (btw, you can tell Breeze to make AJAX calls with amplify). You don't even have to use the Breeze EntityManager to query and save data if you don't want to.
The rest of BreezeJS may still have value for you. There remains plenty of work to do after you've figured out how you'll retrieve and store data and whether you prefer Entity-ChangeSet style or Command/Query style.
You'll have to find answers to these questions:
How will you shape the raw JSON data into bindable objects?
How will you hold on to these objects and share them across multiple screens without making redundant round-trips to the server?
How will you navigate from one object to a related object as you do when binding an Address to a combobox of StatesAndProvinces?
How will you track changes?
How will you validate them?
How will you store some or all of the data in local storage when the app "tombstones"?
Breeze can help with these chores even if you don't want it to query and save for you.
And if you're answer remains "I'll do all of that myself, thank you" ... well, removing Breeze from your HotTowel project is as easy as:
Uninstall-Package breeze.webapi
I wonder If I could implement Observable design pattern in ASP.Net MVC 3.
I want that every time an information like a value existing on the server, the browser should be notified when there is a change.
Can I do this? If yes, how? Please post examples or link to such examples.
There's a few things you should take a look at before you start building your own.
First, SignalR
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx
Second, read this article that was just recently posted about the Trello web stack. They talk about how they implemented client side updating.
http://blog.fogcreek.com/the-trello-tech-stack/
(The pushing and pulling section)
http://en.wikipedia.org/wiki/Long_polling#Long_polling
http://en.wikipedia.org/wiki/Web_worker
Or as simple method use javascript for pinging server time to time to ask if new data exists, and load it when it occured.
I'm trying to get a UI using MVC. I'm currently battling with MVC3. There does’nt seem to be much documentation.
Here’s what I’m thinking. I believe I need to create stored procs for each query. I’m creating the the LINQ to SQL for the model. I’m trying to figure out how to create the cotroller. Any suggestion on how to input data to the stored proc and return results to the view? The default controller classes dont seem to do anything
Am I doing this right? Or MVC2/MVC1 the easier way to go?
I'm new to MVC on .NET. Thanks in advance.
There is plenty of documentation, if you look for it... Also, http://www.asp.net/mvc is a good place to start.
What it seems like you really need documentation for is LINQ-to-SQL, not MVC, which is here: http://msdn.microsoft.com/en-us/library/bb425822.aspx
There's also a great ScottGu tutorial here: http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx
The whole series is available here, including a PDF download: http://scottonwriting.net/sowblog/archive/2010/07/27/links-to-scott-guthrie-s-using-linq-to-sql-tutorials.aspx
I believe I need to create stored procs for each query.
You could do this but it might be an overkill. I would recommend you watching the tutorials here. Paragraph 5. covers tutorials about using Entity Framework for data access. Try them out and if you encounter some specific issues don't hesitate to ask a question by showing what you have tried and what didn't work for you.
If you're using Linq to SQL, you don't need to use Stored Procs at all.
If you want more information on MVC generally, try doing the NerdDinner example.