
What is a Lambda Function in AWS?
AWS Lambda is a cost-effective compute service offered by Amazon AWS, and is a part of AWS Serverless compute suite.
AWS Lambda is a cost-effective compute service offered by Amazon AWS, and is a part of AWS Serverless compute suite.
AsNoTracking() flags the framework to not to track changes on the records returned. EF Core then doesn't persist the result, thus conserving memory.
In general, there are two modes in which an ASP.NET Core application can run, when deployed in IIS.
In-Process model:
Out-Of-Process model:
How do you specify?
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
</PropertyGroup>
.... other config ....
</Project>
Authorization Filters act at the beginning of the request life cycle, before all other filters are executed. It determines if the request is authorized to access the resource or not.
To create an Authorization Filter, one can simply implement the IAuthorizationFilter interface and provide an implementation of the method:
interface IAuthorizationFilter {
OnAuthorization(AuthorizationFilterContext ctx);
}
An ActionFilter can be created in two ways:
IActionFilter contains two methods, that the custom Action Filter needs to implement:
OnActionExecuting(ActionExecutingContext ctx) - before action is executed
OnActionExecuted(ActionExecutedContext ctx) - after action is executed
ActionFilterAttribute abtract class has the below methods which can be overriden as required:
OnActionExecuting(ActionExecutingContext ctx) - before action is executed
OnActionExecuted(ActionExecutedContext ctx) - after action is executed
OnResultExecuting(ResultExecutingContext ctx) - before the ActionResult instance is invoked
OnResultExecuted(ResultExecutedContext ctx) - after the ActionResult instance is invoked
Here are some differences between ViewBag, ViewData and TempData when used in an ASP.NET Core MVC application.
ASP.NET Core WebAPI actions CAN have void return types. The framework returns an EmptyResult for such actions with a default 200 (OK) status Code.
This can be particularly observed in the cases of HttpDelete operations where no return is expected by the client in most cases.
Map, Reduce and Filter are three functions which operate on a given array of values.
let arr = [1, 2, 3, 4, 5];
let result2 = arr.map(function (current, index) {
return current % 2;
});
// output:
[ 1, 0, 1, 0, 1 ]
let result1 = arr.reduce(function (prev, current) {
console.log(`${prev}, ${current}`);
return prev + current;
});
// output:
1, 2
3, 3
6, 4
10, 5
result1: 15
let result3 = arr.filter(function (current, index) {
return current % 2 === 0;
});
// output:
[ 2, 4 ]
We can do it in three steps.
<!DOCTYPE html>
<html>
<body id="myBody">
<div id="mainContainer" class="container-fluid">
<div id="firstRow" class="row">
<div id="fullCol" class="col-md-12">
<h1 id="headingText">Hello World!</h1>
<p id="subHeadingText">
This is some sample text you're viewing on the Page.</p>
</div>
</div>
</div>
<script type="text/javascript">
(function () {
let elements = document.getElementsByTagName("*");
let ids = [];
for (let i = 0; i < elements.length; i++) {
let element = elements[i];
if (element.id) {
ids.push(element.id);
}
}
console.log(JSON.stringify(ids));
})();
</script>
</body>
</html>
output:
["myBody","mainContainer","firstRow","fullCol","headingText","subHeadingText"]