How to implement Breeze with NHibernate and webapi 2 - nhibernate

I'm trying to implement some days Breeze in my project with NHibernate and webapi 2 but without success.
Examples on github are for webapi 1
I'm having several problems, among them:
Not exist BreezeNHController in webapi 2
With IUnitOfWork architecture, ContextProvider was confused.
I tried to add the attribute BreezeController to the controller but to perform the action {{odata}}/GruposUsuarios?$filter=substringof('Vivo', Nome) still having trouble translating the query.
The main objective is to use Breeze to perform queries using odata queries as substringof and expand.
Any help will be appreciated!

The nuget package is now available, and the NorthBreeze sample
is now updated to use Breeze 1.4.8 and WebApi 2
With this update, your queries should be working in Web Api 2. Please let me know if they are not. Thanks.

Related

Pagedlist for asp.net core

In MVC 5 (.Net Framework 4.6) i used PagedList.Mvc with following solutions:
It separates query into pages and gets results for needed page (not all query results).
It used HtmlHelper to render group of buttons with needed filter!
I could customize numbers of pager buttons to display (if get large resultset).
In asp.net core 2.0 documentation https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/sort-filter-page i can't find 2 and 3 solutions.
Does anyone know better approach?
I tried PagedList from https://github.com/dncuug/X.PagedList it worked!
I used X.PagedList this link was very helpful
https://github.com/troygoode/PagedList/blob/master/README.markdown#example

Laravel 5.2 custom Middleware Levels on RESTful controllers

So from not using any framework at all, I finally forced myself to use LARAVEL 5.2 because i got tired of re-writing my own "framework" over and over again.
Anyway!
I think I'm pretty familiar with the Laravel framework and its dependencies now.
But now I need guidance on how to do this the smartest way.
I want to create a Middleware based on the companys DC.
Now every user is AUTHED by php's envget("username"); with a re-written "auth" middleware. So far, so good. (The server is not in the DMZ btw).
The thing is, our team thought that we should populate a database-table with all the users and give them a "Privilege-level", lets say 1 through 3 where 1 is "read only", 2 is "read+modify" and 3 is "read+create+modify" with our restful controllers. But.
since we use restful controllers i cannot really give them individual Middlewares? do I manually have to change every RESTful resource in my routes.php to make this happend? or can i do this another way? I would like to keep it as simple as possible.
Any suggestions?
Thanks in advance
(reserved for typsos )
#Tarre Tan
You can achieve this by adding your middleware in a parent controller's constructor.
All your controllers that require permissions will inherit from that controller.
You have one place to adjust your permissions if you want.
Hope this helps

How to start developing a Web Api 2.2 project with Asp.Net MVC 5

I have an MVC5 Project and Non browser project. We just upgraded from MVC4 to MVC5 and included a Web Api project. Now we want to make use of Web Api 2.2 and we have created some HTTP methods which works fine in our Api Project. My question is how should I start with Authentication/Authorization.Do I need to create an Authentication Filter class inheriting from ActionFilterAttribute. I referred this link How should I begin with . I am confused how should I use the IPrincipal and set the Identity. Any help is highly appreciated.
The new version is called ASP.NET Identity framework - There are some changes from the ASP.NET Membership in the table structure and everything works through Entity Framework, the tables are created using code first but you can also create it using a script, for example: identity.codeplex.com and SQL-script-for-creating-an-ASP-NET-Identity-Databa or you run the solution using a valid SQL connection string and the tables will be created on first run (code first is doing that - it's built in the entity framework)...
When you create a sample MVC project you will have the basic functionality
Also, check out these resources:
http://johnatten.com/2013/11/11/extending-identity-accounts-and-implementing-role-based-authentication-in-asp-net-mvc-5/
http://johnatten.com/2014/06/22/asp-net-identity-2-0-customizing-users-and-roles/
http://johnatten.com/2014/10/26/asp-net-web-api-and-identity-2-0-customizing-identity-models-and-implementing-role-based-authorization/
http://johnatten.com/2014/02/13/asp-net-mvc-5-identity-extending-and-modifying-roles
http://www.asp.net/identity/overview/getting-started/aspnet-identity-recommended-resources
http://www.asp.net/mvc/overview/getting-started
http://johnatten.com/2014/04/20/asp-net-mvc-and-identity-2-0-understanding-the-basics/
Also, the new table primary keys are changed so the code can run on any type of database, so it's a 128 string key by default (just between us - the database optimization could be made a little better than this) if you're looking for some trouble, check out these links as well:
https://github.com/TypecastException/AspNet-Identity-2-With-Integer-Keys
https://github.com/TypecastException/AspNet-Identity-2-Extensible-Project-Template

Update two partial views when any column gets updated

I have a page in which there are two partial views, one to the left and the other to the right. I would like these two views to be refreshed automatically when the tables that they are related to gets updated. Is SignalR the best option? and Is it complicated to implement this to an existing project? Right now I am using javascript 'set interval' to update every few seconds. Instead of doing constant polling I want to update the views only when the data gets refreshed. I am new to SignalR.
This is a ASP.NET mvc project,I want to update these two views only when the information pertaining to this user gets updated.
Please advise!
SignalR is a better option when compared to requesting for update in a regular interval since SignalR solution gives you more instant updates on your UI.
In your case, you might have to send out broadcasts from the server as soon as you update the backend tables.
Is it complicated to implement this to an existing project?
That's upto the architecture of your project, however implementing it in an MVC application is not so hard.
Here is an example of how SignalR is implemented in an MVC project.

Doctrine-based CodeIgniter authentication/acl system

I'm working on web app based on CodeIgniter/Doctrine. I've tested several auth libraries, but all of them use ActiveRecord. Is there a plugin/library that uses Doctrine, or can be adapted to Doctrine?! Or can I use both Doctrine and CodeIgniter in a project?!
You can adapt any auth plugin/library to use Doctrine instead of ActiveRecord. It might be a lot of work to dig through the code, but essentially you'll have to figure out what the plugin/lib is attempting to do with a record (access, modify etc) and then replicate that with a doctrine statement and return the data as expected by the plugin/lib.
I've not used any Auth library/plugin with Doctrine but I've built an ACL for my app using hooks (pre-controller or post-controller works nicely) that works with Doctrine.