Posts

Introducing Entity Framework Core

Image
  Creating A Data Project To preserve our blog entries, we can utilize Entity Framework, which is Microsoft's Object Relational Mapping (ORM) tool. This framework allows developers to interact with data through domain-specific classes without needing to concern themselves with the underlying database. There are two ways to use Entity Framework: The database-first approach: This is when we already have an existing database and generate classes based on that database. The code-first approach: This is when we first write the classes, which will then generate the database. Creating A New Project There are numerous methods for storing data. We can implement an SQLite database when developing the blog. The information will be available for both the Blazor WebAssembly project and the Blazor Server project. To create a new project, follow these steps: Open a PowerShell prompt. Navigate to the MyBlog folder. Create a class library (classlib) by typing the following command- dotnet new cla...

Creating Your First Blazor App

Image
  Creating a Blazor Server Application To start, we will create a Blazor Server application: Start Visual Studio 2019. Press Create a new project, and in the search bar, type blazor . Select Blazor App from the search results and press Next. Now name the project. Name the application MyBlogServerSide , change the solution name to MyBlog , and press Create. Next, choose what kind of Blazor app we should create. Select .NET 5.0 (Current) from the drop-down menu and press Create. Now run the app by pressing Ctrl + F5 (we can also find it under the Debug | Start without debugging). Your first Blazor Server application is ready. Explore the site a bit, navigate to Counter and Fetch data to get a feeling for the load times, and see what the sample application does. This project is based on Blazor Server, which implies that each interaction (such as clicking a button) sends a command through SignalR to the server. The server will then re-render the component and transmit the updates ...

Web Development With Blazor: Introduction (Part 3)

Image
  Blazor WebAssembly Rather than operating Blazor on a server, you can also execute it within your web browser through WebAssembly. The WebAssembly variant of Blazor functions in a manner quite similar to the server version. A render tree is still generated, and rather than executing the Razor pages on the server, they are now executed within our web browser. Because WebAssembly lacks direct access to the DOM, Blazor updates the DOM through direct JavaScript interoperation instead of using SignalR. Disadvantages Of Blazor WebAssembly When compared to other major websites, the size of a Blazor WebAssembly is substantial, and it requires downloading many files. In order to utilize any on-site resources, it is necessary to create a Web API for access. Direct access to the database is not permitted. The code operates within the browser, indicating that it is susceptible to decompilation. This is a situation that all application developers are familiar with, but it may not be as ty...

Web Development With Blazor: Introduction (Part 2)

Image
  Blazor Server Blazor Server uses SignalR to communicate between the client and the server, as shown in the following diagram: SignalR is an open-source library for real-time communication that establishes a connection between clients and servers. It can utilize various methods of data transport and automatically identifies the most suitable protocol depending on the capabilities of both the server and the client. SignalR prioritizes the use of WebSockets, a transport protocol incorporated in HTML5. If for any reason WebSockets is unavailable, it will smoothly revert to an alternative protocol. Blazor is constructed using reusable UI elements referred to as components. Every component comprises C# code, markup, and may also incorporate additional components. Razor syntax allows you to blend markup with C# code, or you can choose to write everything in C# if preferred. User actions (like clicking a button) or events (such as a timer) can cause the components to be refreshed. The el...

Web Development With Blazor: Introduction (Part 1)

Image
  Preceding Blazor In today's world, the approach to app development has evolved. Frameworks like Angular, React, Aurelia, and Vue have transformed the web experience from needing to refresh the entire page to only updating specific sections dynamically. This method of dynamic updates has made page loading faster, as the perceived loading time has been reduced (although the total page load time might not have changed). However, for many developers, adapting to this requires learning a completely new skill set, particularly transitioning from a server-side environment to a frontend built with JavaScript. On the backend, data objects are created in C# and then converted into JSON, which is transmitted through an API and subsequently reconstituted into JavaScript objects on the frontend. In the past, JavaScript functioned differently across various browsers, a problem that jQuery aimed to address by providing a unified API that could be interpreted by web browsers. Nowadays, the varia...

Share an AMI With Organizations and Organizational Units

Image
  About AWS Organizations is a service for managing accounts that allows you to group various AWS accounts into an organization that you establish and oversee from one central location. You have the ability to share an AMI with an organization or a specific Organizational Unit (OU) you've created, in addition to sharing it with particular accounts. A organization is a structure you establish to unify and manage your AWS accounts from a central location. You can arrange the accounts in a hierarchical, tree-like format, with a root node at the top and organizational units positioned beneath the organization root. Each account can either be added directly to the root or organized into one of the organizational units within the hierarchy. When you share an AMI with an organization or an OU, all of the children accounts gain access to the AMI. Considerations Consider the following when sharing AMIs with specific organizations or organizational units: Ownership - To share an AMI, your AW...

Understand Block Public Access for AMIs

Image
  About To stop the public distribution of your AMIs, you can activate block public access at the account level. With block public access turned on, any attempt to make an AMI accessible to the public will be automatically denied. However, any AMIs that are already public will still remain available to the public. To share AMIs publicly, you need to turn off block public access. Once you have finished sharing, it is advisable to reactivate block public access to avoid any accidental public sharing of your AMIs. You can limit IAM permissions for an admin user, allowing only them to turn on or off public access blocking for AMIs. Note: This configuration is set at the account level, either directly within the account or through a declarative policy. It needs to be set in each AWS Region where you wish to restrict the public sharing of your AMIs. Utilizing a declarative policy enables you to implement this configuration across several Regions at once, as well as across multiple accoun...