Skip to content

Update content #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added art/brand/eisk-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/docs/layers-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/eisk-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/intro/eisk-v7-mvc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/intro/eisk-v8-webapi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/intro/eisk-v9-webapi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions docs/webapi/application-development/develop-with-eisk.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>

<head>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-9386106-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-9386106-5');
</script>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Develop With EISK </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Develop With EISK ">
<meta name="generator" content="docfx 2.40.7.0">

<link rel="shortcut icon" href="../../../favicon.ico">
<link rel="stylesheet" href="../../../styles/docfx.vendor.css">
<link rel="stylesheet" href="../../../styles/docfx.css">
<link rel="stylesheet" href="../../../styles/main.css">
<meta property="docfx:navrel" content="../../../toc.html">
<meta property="docfx:tocrel" content="../toc.html">




</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>

<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

<a class="navbar-brand" href="../../../index.html">
<img id="logo" class="svg" src="../../../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>

<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">

<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="eisk-webapi-develop-with-eisk">
<h1 id="develop-with-eisk">Develop With EISK</h1>

<h2 id="explore">Explore</h2>
<p>Once you've been able to load EISK in your visual studio and run it on your browser, you’ve the privilege to explore all cool features available here. EISK is intended to provide a way of quick learning to show how we can utilize latest technologies (Visual Studio, ASP.NET MVC, Entity Framework etc) to build some frequently used web application features, such as viewing, editing of an entity.</p>
<p>After you’re done exploring EISK features, get back to the EISK project in Visual Studio that you lunched. Go through the codes. Having some basic knowledge in ASP.NET MVC &amp; C# will enable you to understand most of the codes.</p>
<p>If you have any questions about how any specific features in implemented, post your queries in the eisk discussion forum.</p>
<h2 id="customize">Customize</h2>
<p>Once you gain enough understanding about how the C# and ASP.NET MVC have been utilized effectively, you’ll want to build your own. Go ahead, start with a sample entity (for instance Customer) with some sample fields, follow the similar coding conventions in EISK and within a short while you’ll start enjoying your code containing latest technologies and coding best practices. Developing your first entity CRUD (Create, Read, Update, Delete) sample will give you more confidence to handle real world programming challenges.</p>
<h2 id="develop">Develop</h2>
<p>Congratulations!</p>
<p>Yes! You know how to customize EISK to include your own data and business logic! Now you can utilize this knowledge to build real life web application with best coding practices.</p>
<p>EISK can be used in fresh new projects (Green field) projects or existing projects (Brown field).</p>
<p>On a Green Field project, keep the sample “Employee” entity and all other relevant classes and resources, which will allow you to develop new entities based on your software requirements with example coding sample. You can mark “Employee” and it’s relevant classes as obsolete using .NET Obsolete attribute. This will allow your C# compiler to have warning message in Visual Studio Error List window, thus you can remove sample codes over time, as your production code get matured.</p>
<p>For a Brown field project, pick any coding sample from EISK and utilize on your project.</p>
</article>
</div>

<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/EISK/eisk.docs/blob/develop/content/docs/webapi/application-development/develop-with-eisk.md/#L1" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>

<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>

<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>

<script type="text/javascript" src="../../../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../../../styles/docfx.js"></script>
<script type="text/javascript" src="../../../styles/main.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>

<head>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-9386106-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-9386106-5');
</script>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Create New Service Api </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Create New Service Api ">
<meta name="generator" content="docfx 2.40.7.0">

<link rel="shortcut icon" href="../../../favicon.ico">
<link rel="stylesheet" href="../../../styles/docfx.vendor.css">
<link rel="stylesheet" href="../../../styles/docfx.css">
<link rel="stylesheet" href="../../../styles/main.css">
<meta property="docfx:navrel" content="../../../toc.html">
<meta property="docfx:tocrel" content="../toc.html">




</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>

<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

<a class="navbar-brand" href="../../../index.html">
<img id="logo" class="svg" src="../../../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>

<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">

<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="eisk-webapi-handson-walkthrough-create-service-api">
<h1 id="create-new-service-api">Create New Service Api</h1>

<p>In this step by step article, you'll be creating a new web api from the scratch through which you can perform CRUD operation on a database entity.</p>
<p>With the utilities and bootstrap code as provided by EISK, you'll realize how easy to create a new web api with Visual Studio and ASP.NET Core.</p>
<p>This article assumes you've basic understanding with Object Oriented Programming.</p>
<h2 id="step-1-check-system-requirements">Step 1: Check System Requirements</h2>
<p>To start developing a new web api, you'll need the following or upper version of Visual Studio. If you've not installed it yet, you can get a free copy of Visual Studio Community Edition from it's download site (link provided below).</p>
<ul>
<li>Visual Studio 2022 (<a href="https://visualstudio.microsoft.com/vs/community/">Free</a> Community Edition or higher)</li>
</ul>
<h2 id="step-2-download-eisk-web-api">Step 2: Download EISK Web Api</h2>
<p>You can download EISK with variety of <a class="xref" href="../downloads/index.html">options and choices</a>.</p>
<p>If you're familiar with <a href="https://git-scm.com/">git</a> (and installed in your local machine) you can perform a git clone with the following git bash command to get latest EISK Web Api code sample.</p>
<p><code>git clone https://github.com/EISK/eisk.webapi.git</code></p>
<p>Alternatively you can run the following dotnet cli (which comes by default with Visual Studio) command to install and create a new EISK Web Api project:</p>
<ul>
<li>Command to install EISK template in your machine: <code>dotnet new -i eisk.webapi</code></li>
<li>Command to create a new project: <code>dotnet new eiskwebapi -n Eisk</code></li>
</ul>
<p>Check <a class="xref" href="../downloads/dotnet-new.html">here</a> for additional details and installtion options with dotnet CLI.</p>
<h2 id="step-3-build--run-locally">Step 3: Build &amp; Run Locally</h2>
<p>After the solution is available, simply click the created solution to open in Visual Studio.</p>
<p>In the solution explorer, you'll be able to see a web api project, few projects providing utility classes and tests. Right click the web api project (default name Eisk.Web) and select &quot;Set as StartUp Project&quot;.</p>
<p>Hit F5, to let visual studio build the solution and open the web api project output in browser.</p>
<p>The index page of the project is basically <a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger">Swagger UI</a>, showing a web console to explore underlying web api.</p>
<p>EISK by default provides a simple use case to perform CRUD operation in an employee table in <a href="https://en.wikipedia.org/wiki/Domain-driven_design">Domain Driven Development</a> fashion.</p>
<p>The Swagger UI enables accessing the &quot;Employees&quot; api different http verbs (get, post, put, delete etc) and perform data operations in database encapculated with Entity Framework.</p>
<p>Invoke the 'Get' call as available in the first options, by considering the following steps:</p>
<p><code>Get (/api/Employees) -&gt; Try it out -&gt; Execute</code></p>
<p>A json response will be shown under &quot;Server response&quot; section with all employees as available in database.</p>
<p>You can perform other http verb operations by following the similar steps mentioned above.</p>
<h2 id="step-4-creating-a-new-service-api">Step 4: Creating a New Service Api</h2>
<p>As you get familiar with the default use case employee, you may want to write your own api with a new use case, so see how the EISK has been designed to write web api easily with best coding and architectural guidelines.</p>
<h3 id="use-case-employee-time-sheet">Use Case Employee Time Sheet</h3>
<p>As an application user, I want to store employee time sheet for different projects everyday. A single time sheet entry may associate zero or one project.</p>
<h3 id="creating-new-domain">Creating New Domain</h3>
<p>To support the above use case, let's create a &quot;EmployeeTimeSheet.cs&quot; domain under the following solution location:</p>
<p><code>Project: Eisk.Domains</code></p>
<p><code>New file path: Entities\EmployeeTimeSheet.cs</code></p>
<pre><code>using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Eisk.Domains.Employee
{
public class EmployeeTimeSheet
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int EmployeeId { get; set; }
public DateTime TimeSheetDate { get; set; }
public float LoggedHours { get; set; }
public string ProjectCode { get; set; }

}
}
</code></pre>
<h3 id="add-property-to-database-context">Add Property to Database Context</h3>
<p>Add a property as provided below in the following solution location:</p>
<p><code>Project: Eisk.DataServices.EFCore</code></p>
<p><code>File location: DataContext\AppDbContext.cs</code></p>
<pre><code>public virtual DbSet&lt;EmployeeTimeSheet&gt; EmployeeTimeSheets { get; set; }
</code></pre>
<h3 id="add-service-api">Add Service Api</h3>
<p>Add a new class as provided below on the following solution location:</p>
<p><code>Project: Eisk.WebApi</code></p>
<p><code>New file location: Controllers\EmployeeTimeSheetsController.cs</code></p>
<pre><code>using Eisk.Core.WebApi;
using Eisk.Domains.Entities;
using Eisk.DomainServices;
using Microsoft.AspNetCore.Mvc;

namespace Eisk.WebApi.Controllers;

[ApiController]
[Route(&quot;[controller]&quot;)]
public class EmployeeTimeSheetsController
:WebApiControllerBase&lt;EmployeeTimeSheet,int&gt;
{
public EmployeeTimeSheetsController(
DomainService&lt;EmployeeTimeSheet, int&gt;
employeeTimeSheetDomainService)
:base(employeeTimeSheetDomainService)
{

}
}
</code></pre>
<h3 id="build--run-locally">Build &amp; Run Locally</h3>
<p>Similar to Step 3, simply press &quot;Control + F5&quot; to open WebApi project in browser.</p>
<p>In the Swagger UI you'll notice a new section is available to test the new api we just created for EmployeeTimeSheets.</p>
<p>Play with the UI to add create, read, update, delete employee time-sheet.</p>
</article>
</div>

<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/EISK/eisk.docs/blob/develop/content/docs/webapi/application-development/handson-walkthrough-create-service-api.md/#L1" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>

<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>

<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>

<script type="text/javascript" src="../../../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../../../styles/docfx.js"></script>
<script type="text/javascript" src="../../../styles/main.js"></script>
</body>
</html>
Loading