Month: August 2014

updated questions in .Net topic

— Check if my model is valid from inside the razor view? Gets the model state dictionary object that contains the state of the model and of model-binding validation. if (ModelState.IsValid){} —write validation in view <div> @using (Html.BeginForm(“Create”, “Client”, FormMethod.Post, new { @class = “form-horizontal”, role = “form” })) { <div> <div>@Html.LabelFor(m => m.Name) <span>@Html.ValidationMessageFor(model => model.Name)</span></div> <div>@Html.TextBoxFor(m => m.Name,… Read more →

AutoEventWireup in asp.net

AutoEventWireup=”false” Required! You should manual set handler for each page event. AutoEventWireup=”true” Noneed to set handler for page event it is automatically searched and fired, it takes time.   Read more →

questions about sql server (database)

Hints Specifies that query optimizer enforce a join strategy between two tables. Join hints are specified in the FROM clause of a query. Join hints enforce a join strategy between two tables. If a join hint is specified for any two tables, the query optimizer automatically enforces the join order for all joined tables in the query, based on the… Read more →

Stored procedure,Dbcontext and Dbset in Entity framework

Stored procedure use in EF Stored procedures and user-defined functions (UDFs) in the database are represented as functions in entity framework. So EDM won’t have any entity or other stuff for stored procedures in the EDM designer. USE [MyDB] GO /****** Object:  StoredProcedure [dbo].[InsertRole]    Script Date: 08/27/2014 11:10:29 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[InsertRole]… Read more →

Json and Xml

Java Script Object Notation is a text based format for exchanging data. JSON is human readable format. JSON is language independent. It is light weight component. It doesn’t need any compilation process to execute it. It supports many languages. Ex: JAVA, C, C#, .net….. It has a standard database structure. It supports two type of structure in database. 1. Store… Read more →

Partial class,partial method and Anonymous Type

Partial class– It is possible to split the definition of a class or a struct, an interface or a method over two or more source files. Each source file contains a section of the type or method definition, and all parts are combined when the application is compiled. There are several situations when splitting a class definition is desirable: When… Read more →

Pattern using in MVC

–Repository Pattern The repository and unit of work patterns are intended to create an abstraction layer between the data access layer and the business logic layer of an application. It is a data access pattern that prompts a more loosely coupled approach to data access. We create the data access logic in a separate class, or set of classes, called… Read more →

updated topic discussion in Mvc

—Route table,Action filter ,validation  and Budling(how to use or call) protected void Application_Start() { AreaRegistration.RegisterAllAreas();//Registers all the areas in ASP.NET MVC. //GlobalFilters.Filters.Add(new HandleErrorAttribute()); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters) ; RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //RegisterGlobalFilters(GlobalFilters.Filters); } ///Route class defined in app_start folder .it is config file. public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);   // routes.MapRoute( //   name: “Default”, //   url: “{controller}/{action}/{id}”, //                   … Read more →

Web portal,web site,web application (project) difference

A web portal is most often one specially-designed Web page which brings information together from diverse sources in a uniform way. Usually, each information source gets its dedicated area on the page for displaying information (a portlet); Portals are becoming a very prevalent and efficient method of communicating information to individuals. There are primarily two types of portals: public and… Read more →

Array and Arraylist

–Array The Array class is not part of the System.Collections namespaces. However, it is still a collection because it is based on the IList interface. The rank of an Array object is the number of dimensions in the Array. An Array can have one or more ranks. The lower bound of an Array is the index of its first element.… Read more →