Jade Bird

Jade Bird

1660190466

DevOps with .NET MAUI using GitHub Actions & Azure DevOps

Let's learn how to get started with a starter DevOps pipeline with .NET MAUI using GitHub Actions & Azure DevOps

We'll walkthrough some sample pipelines and learn how to configure the settings. You'll learn tips and tricks to help you add DevOps goodness to all your .NET MAUI apps!

#devops #github #dotnet #azure 

What is GEEK

Buddha Community

DevOps with .NET MAUI using GitHub Actions & Azure DevOps
Einar  Hintz

Einar Hintz

1602560783

jQuery Ajax CRUD in ASP.NET Core MVC with Modal Popup

In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.

To demonstrate CRUD operations – insert, update, delete and retrieve, the project will be dealing with details of a normal bank transaction. GitHub repository for this demo project : https://bit.ly/33KTJAu.

Sub-topics discussed :

  • Form design for insert and update operation.
  • Display forms in modal popup dialog.
  • Form post using jQuery Ajax.
  • Implement MVC CRUD operations with jQuery Ajax.
  • Loading spinner in .NET Core MVC.
  • Prevent direct access to MVC action method.

Create ASP.NET Core MVC Project

In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N).

From new project window, Select Asp.Net Core Web Application_._

Image showing how to create ASP.NET Core Web API project in Visual Studio.

Once you provide the project name and location. Select Web Application(Model-View-Controller) and uncheck HTTPS Configuration. Above steps will create a brand new ASP.NET Core MVC project.

Showing project template selection for .NET Core MVC.

Setup a Database

Let’s create a database for this application using Entity Framework Core. For that we’ve to install corresponding NuGet Packages. Right click on project from solution explorer, select Manage NuGet Packages_,_ From browse tab, install following 3 packages.

Showing list of NuGet Packages for Entity Framework Core

Now let’s define DB model class file – /Models/TransactionModel.cs.

public class TransactionModel
{
    [Key]
    public int TransactionId { get; set; }

    [Column(TypeName ="nvarchar(12)")]
    [DisplayName("Account Number")]
    [Required(ErrorMessage ="This Field is required.")]
    [MaxLength(12,ErrorMessage ="Maximum 12 characters only")]
    public string AccountNumber { get; set; }

    [Column(TypeName ="nvarchar(100)")]
    [DisplayName("Beneficiary Name")]
    [Required(ErrorMessage = "This Field is required.")]
    public string BeneficiaryName { get; set; }

    [Column(TypeName ="nvarchar(100)")]
    [DisplayName("Bank Name")]
    [Required(ErrorMessage = "This Field is required.")]
    public string BankName { get; set; }

    [Column(TypeName ="nvarchar(11)")]
    [DisplayName("SWIFT Code")]
    [Required(ErrorMessage = "This Field is required.")]
    [MaxLength(11)]
    public string SWIFTCode { get; set; }

    [DisplayName("Amount")]
    [Required(ErrorMessage = "This Field is required.")]
    public int Amount { get; set; }

    [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
    public DateTime Date { get; set; }
}

C#Copy

Here we’ve defined model properties for the transaction with proper validation. Now let’s define  DbContextclass for EF Core.

#asp.net core article #asp.net core #add loading spinner in asp.net core #asp.net core crud without reloading #asp.net core jquery ajax form #asp.net core modal dialog #asp.net core mvc crud using jquery ajax #asp.net core mvc with jquery and ajax #asp.net core popup window #bootstrap modal popup in asp.net core mvc. bootstrap modal popup in asp.net core #delete and viewall in asp.net core #jquery ajax - insert #jquery ajax form post #modal popup dialog in asp.net core #no direct access action method #update #validation in modal popup

Nabunya  Jane

Nabunya Jane

1624939448

A side-by-side comparison of Azure DevOps and GitHub

Collaboration is a crucial element in software development; having the right collaboration tools can make a difference and boost the entire team’s productivity. Microsoft introduced its Application Lifecycle Management product with Team Foundation Server (aka TFS) on March 16th, 2006. This software had to be installed on a server within your network and had a user-based license. To reduce the complexity of setting up and maintaining the server, Microsoft released Visual Studio Online–an Azure-based, server-hosted version of TFS. Microsoft manages and administers the servers as well as taking care of backups. To clarify its commitment to agile and DevOps, Microsoft rebranded Visual Studio Online in 2015 as Visual Studio Team Services and later as Azure DevOps in 2018.

Since its beginning, this platform has changed significantly. For example, it introduced a customizable, task-based build service, release gates, and much more. Many organizations across the world made a significant investment to run their businesses on Azure DevOps. For this reason, after Microsoft announced the acquisition of GitHub in mid-2018, GitHub announced its automated workflow system, which is much like Azure Pipelines. It’s called GitHub Actions. Due to the switch, some companies became afraid of having to migrate their practices again. In the past few months, I have gotten several questions about whether it is still worth starting new projects on Azure DevOps, especially after the release of features like GitHub Advanced Security and GitHub Codespaces (similar to Visual Studio Codespaces). In this article, I’ll clarify the differences between these two platforms, and I’ll give you some advice on how you should be using them to your advantage.

Data Residency

To meet the needs of companies that want to keep their data within their network, both GitHub and Azure DevOps provide a server version of their platform. GitHub version is called GitHub Enterprise Server, and the Azure DevOps version is called Azure DevOps Server. Both versions require the client to install and maintain both software and machine.

On the other hand, there is a critical difference between their cloud-hosted version. While Azure DevOps Service allows you to choose the Azure region, which is closes to your organization’s location, to decrease the eventuality of networking latency during the creation of your organization (collection of projects). GitHub doesn’t provide this feature.

Project management and bug tracking

GitHub

At the core of GitHub project management, we can find the issues. This task can be used to track any work item, from feature to bugs, and can be sorted into a Kanban-style board for easy consultation. The issue’s description also supports markdown syntax. Adding a specific keyword #issue-number (ex: #3) can associate the issue with another one. Each issue can be assigned to multiple developers, be linked to pull requests, and have various labels assigned to it. One can link a pull request to an issue to show that a fix is in progress and automatically close the issue when someone merges the pull request.

GitHub Kanban board

  • Lastly, multiple issues can be grouped into milestones that will give immediate feedback about the completion percentage. Milestones can also include a due date.

#azure-devops #microsoft #azure #github #azure devops #azure devops and github

Jade Bird

Jade Bird

1660190466

DevOps with .NET MAUI using GitHub Actions & Azure DevOps

Let's learn how to get started with a starter DevOps pipeline with .NET MAUI using GitHub Actions & Azure DevOps

We'll walkthrough some sample pipelines and learn how to configure the settings. You'll learn tips and tricks to help you add DevOps goodness to all your .NET MAUI apps!

#devops #github #dotnet #azure 

Osborne  Durgan

Osborne Durgan

1591093172

Create, Build, Deploy and Configure an Azure Function with Azure DevOps and Azure CLI

This post shows how to create, build, deploy and configure an Azure Function using Azure DevOps, Azure CLI and Powershell. An Azure Function is created in Azure using Azure DevOps with Azure CLI and Powershell. The Azure Function (V3) project is created and built using Visual Studio and C#. This project is deployed to the Azure infrastructure using a second Azure DevOps Pipeline. The Azure Function configuration settings is configured to use Azure Key Vault for secrets.

#asp.net core #azure #devops #.net core #azure devops #azure functions #cli #powershell

Trace  Hoeger

Trace Hoeger

1623318720

Integration Testing for ASP.NET Core using EF Core Cosmos with XUnit and Azure DevOps

This article shows how integration tests could be implemented for an ASP.NET Core application which uses EF Core and Azure Cosmos. The database tests can be run locally or in an Azure DevOps build using the Azure Cosmos emulator. XUnit is used to implement the tests.

Code: https://github.com/damienbod/AspNetCoreEfCoreCosmosTesting

EF Core is used to the access Azure Cosmos database. An EF Core **DbContext **was created to access Cosmos. This is like any EF Core context, with the **DBSet **definitions as required. Some Cosmos specific definitions are added using the **OnModelCreating **method. See the Cosmos-specific model customization for more details.

public class CosmosContext : DbContext

{

public CosmosContext(DbContextOptions<CosmosContext> options)

: base(options) { }

public DbSet<MyData> MyData { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)

{

modelBuilder.HasDefaultContainer(``"MyDataStore"``);

modelBuilder.Entity<MyData>()

.ToContainer(``"MyDataItems"``);

modelBuilder.Entity<MyData>()

.HasPartitionKey(o => o.PartitionKey);

modelBuilder.Entity<MyData>()

.Property(d => d.ETag)

.IsETagConcurrency();

}

}

The **MyData **class is is used to model the Cosmos documents. This has a **PartitionKey **and also an **ETag **which can be used for the Optimistic concurrency validation.

1

2

3

4

5

6

7

8

public class MyData

{

public string Id { get; set; }

public string PartitionKey { get; set; }

public string Name { get; set; }

public string Description { get; set; }

public string ETag { get; set; }

}

The **MyDataService **service class is used to access the context and implement some query logic as required. I like to keep this simple and not separate the specification of the queries from the the business or the Linq statements. This reduces the amount of code and keeps the data access, business simple and makes it easy to adapt.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

public class MyDataService

{

private CosmosContext _cosmosContext;

public MyDataService(CosmosContext cosmosContext)

{

_cosmosContext = cosmosContext;

}

public void EnsureCreated()

{

_cosmosContext.Database.EnsureCreated();

}

public async Task CreateAsync(MyData myData)

{

await _cosmosContext.MyData.AddAsync(myData);

await _cosmosContext.SaveChangesAsync(false);

}

public async Task<MyData> Get(string id)

{

return await _cosmosContext.MyData.FirstAsync(d => d.Id == id);

}

public async Task<IList<MyData>> NameContains(string name)

{

return await _cosmosContext.MyData

.Where(d => d.Name.Contains(name)).ToListAsync();

}

}

The **ConfigureServices **method adds the services required to use EF Core and Cosmos DB. The services are used in a Razor page application, but this could be any web application, ASP.NET Core API or ASP.NET Core Blazor.

1

2

3

4

5

6

7

8

9

10

11

12

13

public void ConfigureServices(IServiceCollection services)

{

services.AddDbContext<CosmosContext>(options =>

{

options.UseCosmos(

"AccountEndpoint=[https://localhost:8081/;AccountKey=C2y6yDjf5/R](https://localhost:8081/;AccountKey=C2y6yDjf5/R)+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="``,

databaseName: "MyDataDb"

);

});

services.AddScoped<MyDataService>();

services.AddRazorPages();

}

The service needs to be tested. Instead of mocking away the database or using separate specifications classes as parameters, the service can be tested as one using Azure Cosmos emulator and EF Core. We used the framework tools to test our code. An EF Core in-memory database could also be used instead of the Azure Cosmos emulator. We use the emulator for these tests.

#.net core #asp.net core #web #azure #azure devops #asp.net