GithubHelp home page GithubHelp logo

ruchinmunjal / net4samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from easyquery/net4samples

0.0 1.0 0.0 1.49 MB

Sample projects for EasyQuery editions for .NET Framework (WPF, WinForms, ASP.NET 4)

C# 51.14% CSS 3.90% HTML 19.30% XML 12.16% Visual Basic .NET 5.40% ASP.NET 8.11%

net4samples's Introduction

EasyQuery .NET 4 Samples

This repository contains several .NET 4.x projects which show how to use EasyQuery library in different scenarios.

EasyQuery packages

NuGet Stable NuGet Preview NPM Latest
NuGet NuGet Npm

EasyQuery.JS browsers support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Opera
Opera
Without jQuery
IE11, Edge last version last version last version without jQuery

Prerequisites

To run these samples you will need:

Getting started with Visual Studio

  • Clone the repository
  • Open EqNet4Samples.sln solution file in Visual Studio
  • Build and run.

EqAspNet4Demo project

This project implements several of the most usual scenarios of using EasyQuery in an ASP.NET MVC web-application. We tried to combine all these cases in one application for two reasons:

  • to simplify the demonstration process since it's easier to set up and run one project instead of several different projects.
  • to show how to configure different scenarios of using EasyQuery in one application.

So, when you start this sample project you will see an index page which leads you to the following demo pages:

Advanced search

The page itself is implemented as a MVC view (Views/Home/AdvancedSearch.cshtml) and it corresponds to the AdvancedSearch action in the HomeController. The scripts and CSS files are taken directly from our CDN and the initialization of the client-side code was done right in the Scripts section of .cshtml file. All AJAX requests from this page are handled by AdvancedSearchController WebAPI controller (Controllers/EasyQuery/AdvancedSearchController.cs). It is listening for requests on /api/easyquery endpoint. The model is loaded from the XML file App_Data/NWindSQL.xml but you can easily switch to loading it directly from DB connection (just replace options.UseModelLoader((_) => new FileModelLoader(path)); line with options.UseDbConnectionModelLoader()).

Ad-hoc reporting

This is the page which demonstrates full capabilities of EasyQuery library: columns editing (with ColumnsBar widget), saving/loading of the queries (reports) to some server-side storage and loading the data model directly from a DbContext. The page is available at Views/Home/AdhocReporting.cshtml. The server-side part is processed by EasyQueryEasyReportController ( you can find it in Controllers/EasyQuery/EasyReportController.cs).

Data filtering

To implement this scenario we used a totally different approach. The page which is responsible for the implementation of this scenario is available at Views/Order/Orders.cshtml. The only widget added on that page is FilterBar.

Instead of WebAPI controller, the server-side part in this scenario is handled by a usual MVC controller (Controllers/OrderController.cs file). Basically, in addition to Index action it contains only 3 extra methods which handles the requests from EasyQuery client-side code: GetModel (returns the model), GetList (returns the lists of values for lookup columns) and ApplyQueryFilter which executes the query (filter) over Orders DbSet using DynamicQuery extension method and passes the result lost of orders to _OrderListPartial partial view for rendering.

This is a great demonstration of using EasyQuery components without a WebAPI.

Full-text search

The last scenario is even simpler than the previous one. It demonstrates how quickly you can implement a full-text search over your database with only one useful extension function provided by EasyQuery: FullTextSearchQuery. The page is implemented as usual MVC action/view pair (Controllers/CustomerController and Views/Customer/Customers.cshtml). It does not contain any EasyQuery JavaScript at all. All the magic happens in the Index method of the controller's class: we just call our FullTextSearchQuery function over the Customers DB set there. On the page, we also use EqHighLightFor HTML helper to highlight the found parts of the text inside the data table.

Sample database

All of these demo projects work with some sample database. That database is created and initialized automatically at the first start. It may take some time (up to 1 minute) - so, please don't worry. Next time the app will be up and ready in a few seconds after launch.

The sample database is created in your SQL Express LocalDB instance by default. To change that you can modify the connection string in web.config file in the project's folder.

Links

net4samples's People

Contributors

antifree avatar korzh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.