푸터 콘텐츠로 바로가기
.NET 도움말

dotnetify.NET (How It Works For Developers)

DotNetify is an open-source framework made with .NET and Blazor designed for creating real-time web applications on a .NET platform. By utilizing SignalR's power for real-time interactions between the client and server, it simplifies the construction of dynamic and interactive web applications. DotNetify provides a programming model that synchronizes client-side views with server-side scripting data, allowing developers to design rich, responsive, and performant online interfaces quickly and easily.

Conversely, IronPDF PDF Generation Library is a potent .NET package that facilitates creating, editing, and manipulating PDF documents programmatically. It is an excellent choice for creating dynamic, data-driven documents like reports, invoices, and forms, offering an intuitive API for transforming HTML text into PDFs.

By integrating DotNetify with IronPDF, real-time web interactivity and robust PDF production capabilities are combined in a C# application. This integration is particularly beneficial for applications requiring real-time data display and the ability to dynamically create and distribute PDF documents based on the most recent data. Developers can create extensive, interactive online apps that address complex business requirements and enhance user experiences through seamless document generation and distribution by leveraging IronPDF's versatile PDF generation and DotNetify's real-time data synchronization.

What is DotNetify?

DotNetify is an open-source framework designed to simplify creating interactive, real-time web apps with .NET and Blazor. Developers can create dynamic and responsive user interfaces that effortlessly synchronize with server-side data by utilizing SignalR, facilitating real-time communication between the client and server. DotNetify uses a reactive programming approach, abstracting the complexities of real-time data binding and event handling, thereby simplifying the creation of complex online applications with minimal code.

dotnetify .NET (How It Works For Developers): Figure 1

DotNetify allows developers to construct server-side view models that immediately propagate changes to the client, ensuring that the user interface always reflects the application's state. This framework offers flexibility in choosing client-side technology, supporting both classic JavaScript front-ends and Blazor front-ends. It is ideal for applications requiring real-time updates, such as dashboards, collaborative tools, and live data streams, due to its ease of use and effectiveness.

DotNetify's real-time handling of intricate interactions and data flows significantly enhances user experience by enabling smooth data synchronization and immediate feedback. Overall, DotNetify is a valuable tool for .NET developers aiming to build reactive, cutting-edge, real-time online applications quickly and efficiently.

Features of DotNetify

DotNetify in C# offers a myriad of features that simplify the creation of interactive, real-time online apps, including:

  • Real-Time Communication: Utilizes SignalR for bi-directional, real-time client-server communication, enabling interactive user interfaces and instant updates.
  • Reactive Programming Model: Provides a reactive programming model, automatically synchronizing client-side views and server-side view models to keep the user interface current with the latest information.
  • Server-Side View Models: Facilitates the creation of server-side view models that client-side components can bind to, simplifying state management and data flow within the application.
  • Blazor and JavaScript Support: Supports both classic JavaScript front-ends and Blazor front-ends, allowing developers to choose the client-side technology that best fits their requirements.
  • Ease of Integration: Seamlessly integrates real-time functionality into new or existing projects, and works well with front-end UI component frameworks like WebSockets, blending with projects using React Native, Vue, and Blazor.
  • Scalability: Inherits SignalR's scalability features, enabling applications to manage many concurrent connections effectively.
  • MVVM Architecture: Adopts the Model-View-ViewModel (MVVM) architecture, aiding in separating responsibilities and maintaining organized and clean code.
  • Event Handling: Reduces the boilerplate code needed for handling UI interactions and state changes by streamlining event handling and data binding.
  • Extensible and Customizable: Provides extensibility points and hooks for behavior customization and necessary integration with other libraries or frameworks.
  • Robust Infrastructure: Offers a dynamic routing mechanism that can be entirely defined on the back end, capable of nested routing, token-based authentication, and more.
  • Open Source and Community-Driven: As an open-source project, DotNetify benefits from community participation and contributions, ensuring ongoing upgrades and improvements.

Creating and Configuring DotNetify in C#

To establish a simple project and begin configuring DotNetify in a C# online application, follow these steps. This tutorial demonstrates how to use ASP.NET Core and Blazor to set up a basic DotNetify server and client.

Set Up a New ASP.NET Core Blazor Server Project

  1. Open Visual Studio: Launch Visual Studio and create a new project.
  2. Create a Blazor Server App: Choose the Blazor Server App template from the project templates and click "Next."
  3. Configure Your Project: Provide a name for your project (e.g., "DotNetifyWebApp") and make the necessary configuration changes. Click "Create."

Install DotNetify via NuGet

  1. Manage NuGet Packages: In the Solution Explorer, right-click your project and choose "Manage NuGet Packages."
  2. Search for DotNetify: Install the DotNetify and DotNetify.Blazor packages.

Configure DotNetify

To configure DotNetify, open Startup.cs and use the ConfigureServices and Configure methods.

using DotNetify;
using DotNetify.Blazor;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        services.AddSignalR();
        services.AddDotNetify();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Error");
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseRouting();
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapBlazorHub();
            endpoints.MapFallbackToPage("/_Host");
            endpoints.MapHub<DotNetifyHub>("/dotnetify");
        });
    }
}
using DotNetify;
using DotNetify.Blazor;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        services.AddSignalR();
        services.AddDotNetify();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Error");
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseRouting();
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapBlazorHub();
            endpoints.MapFallbackToPage("/_Host");
            endpoints.MapHub<DotNetifyHub>("/dotnetify");
        });
    }
}
$vbLabelText   $csharpLabel

Create a ViewModel

Create a new class file in your project (for example, HelloWorldViewModel.cs) and design a basic ViewModel.

using DotNetify;

public class HelloWorldViewModel : BaseVM
{
    public string Greetings => "Hello, World!";
}
using DotNetify;

public class HelloWorldViewModel : BaseVM
{
    public string Greetings => "Hello, World!";
}
$vbLabelText   $csharpLabel

Register ViewModel

Before registering the ViewModel, open Program.cs.

using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

public class Program
{
    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
            })
            .ConfigureServices(services =>
            {
                services.AddTransient<HelloWorldViewModel>();
            });
}
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

public class Program
{
    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
            })
            .ConfigureServices(services =>
            {
                services.AddTransient<HelloWorldViewModel>();
            });
}
$vbLabelText   $csharpLabel

Create Blazor Component

In your project, add a new Blazor component (such as HelloWorld.razor) and connect it to the ViewModel.

@page "/"

@using DotNetify
@using DotNetify.Blazor
@inject IDotNetifyService DotNetify

<h3>@greetings</h3>

@code {
    private string greetings;

    protected override async Task OnInitializedAsync()
    {
        var vm = await DotNetify.ConnectAsync<HelloWorldViewModel>(this);
        greetings = vm.Greetings;
    }
}
  • Sets up the application to utilize DotNetify, Blazor, Razor Pages, and SignalR.
  • Configures DotNetify and Blazor endpoints and routing.
  • Describes a basic ViewModel with a greeting message-returning attribute.
  • Registers the HelloWorldViewModel as a service.
  • The Blazor component establishes a connection with the HelloWorldViewModel, retrieves the welcome text, and displays it on the screen.

dotnetify .NET (How It Works For Developers): Figure 2

Getting Started

To use DotNetify and IronPDF, you need to create a .NET project and incorporate both libraries into your application. Here's a step-by-step tutorial to get you started:

What is IronPDF?

The feature-rich .NET library IronPDF PDF Library enables C# programs to produce, read, and edit PDF documents. With this library, developers can quickly turn HTML, CSS, and JavaScript information into high-quality, print-ready PDFs. Key tasks include adding headers and footers, splitting and merging PDFs, watermarking documents, and converting HTML to PDF.

IronPDF is relevant to a variety of applications because it supports both .NET Framework and .NET Core. With their simplicity of use and abundant information, PDFs can be easily integrated into developers' products. IronPDF handles complex data layouts and formatting, ensuring the PDFs it generates closely resemble the client's original HTML text. Additionally, IronPDF supports cross-platform apps like Windows, web, and mobile environments.

dotnetify .NET (How It Works For Developers): Figure 3

Features of IronPDF

  • PDF Generation from HTML: Convert JavaScript, HTML, and CSS to PDF. IronPDF supports media queries and responsive design, two contemporary web standards. Its support for modern web standards is useful for dynamically decorating PDF invoices, reports, and documents with HTML and CSS.

  • PDF Editing: Pre-existing PDFs can have text, images, and other content added to them. Developers can use IronPDF to extract text and images from PDF files, combine multiple PDFs into one file, split PDF files into several separate papers, and include watermarks, annotations, headers, and footers.

  • PDF Conversion: Convert several file formats, including Word, Excel, and picture files, to PDF format. IronPDF also supports PDF-to-image conversion (PNG, JPEG, etc.).

  • Performance and Reliability: High performance and reliability are desired design qualities in industrial settings. With IronPDF, developers can manage large document sets with ease.

Install IronPDF

To gain the tools needed to work with PDFs in .NET projects, install the IronPDF package.

Install-Package IronPdf

Integrate DotNetify with IronPDF

Configure DotNetify:

Startup Configuration: Open Startup.cs and configure DotNetify using the ConfigureServices and Configure methods.

using DotNetify;
using DotNetify.Blazor;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        services.AddSignalR();
        services.AddDotNetify();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Error");
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseRouting();
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapBlazorHub();
            endpoints.MapFallbackToPage("/_Host");
            endpoints.MapHub<DotNetifyHub>("/dotnetify");
        });
    }
}
using DotNetify;
using DotNetify.Blazor;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        services.AddSignalR();
        services.AddDotNetify();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Error");
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseRouting();
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapBlazorHub();
            endpoints.MapFallbackToPage("/_Host");
            endpoints.MapHub<DotNetifyHub>("/dotnetify");
        });
    }
}
$vbLabelText   $csharpLabel

Create a ViewModel

Add a new class file in your project (e.g., PdfViewModel.cs) and create a ViewModel that will produce a PDF.

using DotNetify;
using IronPdf;

public class PdfViewModel : BaseVM
{
    public string PdfUrl { get; set; }

    public void GeneratePdf()
    {
        // Create a new PDF renderer instance
        var Renderer = new ChromePdfRenderer();

        // Render HTML as a PDF document
        var PdfDocument = Renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>");

        // Define the output path for saving the PDF
        var OutputPath = "wwwroot/PdfFiles/HelloWorld.pdf";

        // Save the generated PDF document
        PdfDocument.SaveAs(OutputPath);

        // Update the property for the PDF URL
        PdfUrl = "/PdfFiles/HelloWorld.pdf";
        Changed(nameof(PdfUrl));
    }
}
using DotNetify;
using IronPdf;

public class PdfViewModel : BaseVM
{
    public string PdfUrl { get; set; }

    public void GeneratePdf()
    {
        // Create a new PDF renderer instance
        var Renderer = new ChromePdfRenderer();

        // Render HTML as a PDF document
        var PdfDocument = Renderer.RenderHtmlAsPdf("<h1>Hello World!</h1>");

        // Define the output path for saving the PDF
        var OutputPath = "wwwroot/PdfFiles/HelloWorld.pdf";

        // Save the generated PDF document
        PdfDocument.SaveAs(OutputPath);

        // Update the property for the PDF URL
        PdfUrl = "/PdfFiles/HelloWorld.pdf";
        Changed(nameof(PdfUrl));
    }
}
$vbLabelText   $csharpLabel

Create a Blazor component by adding a new component (e.g., GeneratePdf.razor) and binding it to the ViewModel.

@page "/"

@using DotNetify
@using DotNetify.Blazor
@inject IDotNetifyService DotNetify

<PageTitle>Generate PDF</PageTitle>
<h3>Generate PDF</h3>

<button @onclick="GeneratePdf">Generate PDF</button>

@if (!string.IsNullOrEmpty(pdfUrl))
{
    <a href="@pdfUrl" target="_blank">Download PDF</a>
}

@code {
    private string pdfUrl;

    protected override async Task OnInitializedAsync()
    {
        var vm = await DotNetify.ConnectAsync<PdfViewModel>(this);
        pdfUrl = vm.PdfUrl;

        vm.PropertyChanged += (sender, args) =>
        {
            if (args.PropertyName == nameof(vm.PdfUrl))
            {
                pdfUrl = vm.PdfUrl;
                StateHasChanged();
            }
        };
    }

    private void GeneratePdf()
    {
        DotNetify.CallMethod("GeneratePdf");
    }
}

By integrating DotNetify and IronPDF in a C# ASP.NET Core Blazor application, real-time data handling and dynamic PDF production are made possible. The setup begins with configuring the project in Startup.cs, where services for Razor Pages, Blazor Server, SignalR, and DotNetify are registered to enable server-side Blazor and real-time features.

In PdfViewModel.cs, IronPDF's PDF generation logic is defined. The PDF file can be generated with just a few lines of code. The GeneratePdf function converts HTML content into a PDF and updates the PdfUrl property, informing the client of the new file's location. Communication with the GeneratePdf.razor Blazor component is handled by this ViewModel.

dotnetify .NET (How It Works For Developers): Figure 4

The component connects to the PdfViewModel via the IDotNetifyService and binds to its properties, enabling the client to call the GeneratePdf function and respond to property changes. When users click the "Generate PDF" button, the ViewModel's method is invoked, creating the PDF and dynamically updating the download URL. With this configuration, the web application delivers a responsive and engaging user experience by combining IronPDF's powerful document-generating capabilities with DotNetify's real-time data synchronization.

dotnetify .NET (How It Works For Developers): Figure 5

Conclusion

Integrating DotNetify with IronPDF combines real-time data synchronization and dynamic PDF production in a C# ASP.NET Core Blazor application. DotNetify enables seamless communication between client-side Blazor components and server-side ViewModels, leading to interactive and responsive applications. This is complemented by IronPDF, which provides robust tools for creating and modifying PDFs directly from server-side logic. This powerful combination permits the development of applications capable of creating and distributing customized documents, as well as real-time updates.

This integration leverages real-time data handling and document generation technologies to enhance user experience, whether for reporting, invoicing, or any other document-related task. By following the outlined steps, developers can efficiently set up and utilize these tools, unlocking new possibilities in modern web application development.

With IronPDF and Iron Software Developer Tools, developers eager to explore its extensive features can utilize functionalities like OCR, barcode scanning, PDF production, and more. Provided license alternatives related to the project are specified in detail, allowing developers to choose the best model that fits their needs. The listed advantages contribute to developers delivering timely, coordinated, and effective solutions for a multitude of challenges.

자주 묻는 질문

닷넷티파이란 무엇이며 어떻게 작동하나요?

닷넷티파이는 실시간 웹 애플리케이션 개발을 위해 설계된 .NET 및 블레이저로 구축된 오픈 소스 프레임워크입니다. SignalR을 사용하여 클라이언트와 서버 간의 실시간 통신을 가능하게 하여 동적인 대화형 웹 애플리케이션을 쉽게 만들 수 있습니다.

실시간 웹 애플리케이션과 C#의 PDF 생성을 통합하려면 어떻게 해야 하나요?

개발자는 실시간 웹 애플리케이션용 DotNetify와 PDF 생성용 IronPDF를 결합하여 실시간 데이터 입력을 기반으로 PDF 문서를 동적으로 생성 및 배포하는 대화형 애플리케이션을 만들 수 있습니다.

IronPDF는 PDF 문서 조작을 위해 어떤 기능을 제공하나요?

IronPDF는 프로그래밍 방식으로 PDF 문서를 생성, 편집 및 변환하는 기능을 제공합니다. HTML, CSS 및 JavaScript를 PDF로 변환할 수 있으며 다양한 PDF 조작을 지원하므로 보고서 및 동적 문서를 생성하는 데 이상적입니다.

닷넷티파이는 실시간 애플리케이션 개발을 어떻게 향상시키나요?

닷넷티파이는 클라이언트 측 보기를 서버 측 데이터와 동기화하는 프로그래밍 모델을 제공하여 반응형 대화형 웹 인터페이스를 만들 수 있도록 함으로써 실시간 애플리케이션 개발을 향상시킵니다. 유연한 개발 환경을 위해 JavaScript와 Blazor를 모두 지원합니다.

DotNetify에서 SignalR을 사용하면 어떤 이점이 있나요?

DotNetify의 SignalR은 대화형 반응형 웹 애플리케이션을 만드는 데 필수적인 실시간 클라이언트-서버 통신을 지원합니다. 이를 통해 애플리케이션 내에서 즉각적인 업데이트와 동적 상호 작용이 가능합니다.

IronPDF는 .NET 애플리케이션에서 동적 보고서를 생성하는 데 어떻게 도움이 되나요?

IronPDF는 CSS와 JavaScript를 포함한 HTML 콘텐츠를 고품질 PDF 문서로 변환하여 동적 보고서를 생성할 수 있습니다. 이는 데이터 기반 보고서 및 송장 생성이 필요한 애플리케이션에 특히 유용할 수 있습니다.

닷넷파이에서 뷰모델의 역할은 무엇인가요?

닷넷티파이에서 뷰모델은 클라이언트와 서버 간의 데이터 동기화를 처리하는 데 사용됩니다. 뷰모델은 일관된 데이터 흐름을 유지하여 반응형 사용자 인터페이스를 갖춘 애플리케이션 개발을 용이하게 합니다.

DotNetify와 IronPDF를 결합하면 사용자 경험이 어떻게 개선되나요?

DotNetify와 IronPDF를 결합하면 단일 애플리케이션 내에서 실시간 데이터 업데이트와 동적 PDF 생성이 가능하여 사용자 경험이 향상됩니다. 이러한 통합을 통해 원활한 문서 생성 및 배포가 가능하여 애플리케이션의 기능이 향상됩니다.

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.