Last night I learned something new about C # 6.0.
There is a table created in the database:
CREATE TABLE [dbo]. [Toollocation]
(
[TOOLLOCATION_NBR] SMALLINT IDENTITY (1,1) NOT null PRIMARY KEY,
[LocationName] NVARCHAR (a) not NULL,
[ Description] NVARCHAR null,
[isactive] BIT not NULL DEFAULT (1)
) go
Source Code
Look at the contrast and the wording:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Namespace Insus.NET.Models
{public
class toollocation
{public short
TOOLLOCATION_NBR {get; set;} = 1;
public string LocationName {get; set;} = String. Empty;
public string Description {get; set;} = String. Empty;
public bool IsActive {get; set;} = true;
}}
Source Code
The following insus.net demonstrates creating an entity:
Using Insus.NET.Models;
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Namespace Insus.NET.Entities
{public
class toollocationentity
{public
ienumerable< Toollocation> toollocations ()
{return
new list<toollocation> () {
new toollocation (),
New Toollocation {TOOLLOCATION_NBR = 2, LocationName = "A2", Description = "A2 CNC", IsActive = true},
new Toollocati on {TOOLLOCATION_NBR = 3, LocationName = "C4", Description = "C4 CNC", IsActive = False}}}
Source Code
It will have three objects, and the first object is to use the default value.
In the controller:
In the ASP.net MVC view, display this data:
Look at the effect of the operation:
Above this C # 6.0 properties of the syntax and the initial value of the explanation is small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.