Signum Framework

repository·master·Indexed 42 days ago

https://github.com/signumsoftware/framework

An open-source, data-centric framework for building complex business applications using .NET Core, C#, ASP.NET Web.API, TypeScript, and React. It features a vertical module architecture, the Signum.Engine ORM with a full LINQ Provider, and Signum.React for creating SPAs with Bootstrap and D3. Supports Microsoft SQL Server and PostgreSQL.

Tokens
129.4K
Snippets
403
Records
537
Agent score
53%

What's inside Signum Framework

  1. Overview of Signum Framework

    master

    Signum Framework is an open-source framework designed for building data-centric applications using modern Microsoft technologies (.NET Core, C#, ASP.NET Web.API, TypeScript) and web standards (React, Bootstrap, D3). It supports Microsoft SQL Server and PostgreSQL as data stores.

    Key architectural characteristics include:

    • Vertical Modules (Bounded Contexts): The framework is designed to allow developers to write modules containing database tables, entities, logic, and React UI components that can be shared across different projects.
    • Entities-First Approach: Uses Signum.Entities to place entities at the center of the N-layer architecture.
    • Signum.Engine ORM: A high-performance ORM featuring a full LINQ Provider that prevents the N+1 problem and allows for UPDATE, DELETE, and INSERT operations without requiring a prior retrieval of the entity.
    • Signum.React: Enables the creation of Single Page Applications (SPA) using React, Bootstrap, and TypeScript.
  2. Overview of Signum.Utilities

    master

    Signum.Utilities is the foundational assembly of the Signum Framework. It is a collection of general-purpose tools designed to fill small gaps in the .NET Framework. It can be used as a standalone library in any project because it has no external dependencies.

    Key design principles:

    • Small over Big: Focuses on filling small functional gaps rather than providing large feature sets.
    • Functional over Imperative: Prioritizes functional programming styles and heavy use of lambda expressions for readability and scalability.
    • Handy over Intellectually Gratifying: Prioritizes practical, easy-to-use tools over complex theoretical implementations.
    • No dependencies: Can be easily integrated into any project without bringing in additional assembly requirements.
  3. Overview of Signum Framework capabilities

    master

    Signum Framework is a comprehensive toolset designed to assist in all stages of building business applications. It provides specialized support for:

    • Entity Modeling: Defining the core data structures of your application.
    • Data Access: Interacting with databases via a built-in ORM and a LINQ provider.
    • User Interfaces: Building both Windows (WPF/XAML) and Web (ASP.NET MVC, Razor, JavaScript, TypeScript, and Bootstrap) interfaces.
    • Testing: Integrated support for application testing.
  4. Introduction to Signum.Utilities.ExpressionTrees

    master

    The Signum.Utilities.ExpressionTrees library provides general-purpose utility classes designed for working with .NET ExpressionTrees and building custom LINQ providers.

    Note: While these classes are public, they are intended for very advanced scenarios, such as implementing a new LINQ provider. They are primarily used internally by the Signum.Engine LINQ provider and other core framework components.

  5. Automate entity creation with EntityCodeGenerator

    master

    The EntityCodeGenerator automates the creation of C# entity classes by reading your database schema via SchemaSynchronizer.DefaultGetDatabaseDescription. It generates one entity per table, automatically applying necessary field attributes such as SqlDbTypeAttribute, ColumnAttribute, TableAttribute, and PrimaryKeyAttribute.

    Using this generator ensures that once your entities are registered in the Schema, synchronizing the database will result in minimal changes because the generated code is tightly coupled to the database schema.

  6. Core components of Signum.Engine

    master
    Signum.Engine is the server-side assembly responsible for database access via entities. It provides the primary interfaces for ORM operations, LINQ queries, and administrative schema management. Because it handles direct entity-to-database mapping, it should only be referenced by the server-side application.
  7. Explore Signum Extensions

    master

    Signum Extensions is a set of ready-to-use modules that complement the core Signum Framework. These modules can be integrated into any Signum Framework application to add advanced functionality.

    Available modules include:

    • Authorization
    • Charting
    • Dashboards
    • Mailing
    • Processes
    • Scheduled Tasks
    • Disconnected mode
    • User Queries

    For a full list of modules, visit Signum Extensions.

  8. Use ExpressionHelper for Expression Visitors

    master

    The ExpressionHelper is a static utility class designed to assist when implementing custom ExpressionVisitor logic. It provides extension methods to simplify common tasks such as type conversion, argument retrieval from method calls, and cleaning up lambda expressions.

    // Example of the available extension methods
    public static class ExpressionHelper
    {
        public static ReadOnlyCollection<T> NewIfChange<T>(this ReadOnlyCollection<T> collection, Func<T,T> newValue)
        public static Expression TryConvert(this Expression expression, Type type)
        public static Expression Nullify(this Expression expression)
        public static Expression GetArgument(this MethodCallExpression mce, string parameterName)
        public static Expression TryGetArgument(this MethodCallExpression mce, string parameterName)
        public static LambdaExpression StripQuotes(this Expression e)
        public static bool IsBase(this IQueryable query)
    }
  9. What is a QueryToken (Advanced)

    master

    A QueryToken is a chain of identifiers used as filters or columns in a query. In the SearchControl, as a user interacts with DropDownLists, they are building a QueryToken.

    Common types include:

    • ColumnToken
    • EntityPropertyToken
    • CountToken
    • AggregateToken

    Tokens have a Parent property that forms the chain. They can be parsed using QueryUtils.Parse and converted into a System.Expression for the LINQ provider.

  10. What is a Connector in Signum Framework

    master

    A Connector is a connection factory that encapsulates the Schema and the connectionString required to access a specific database. It serves as the central point for database access, providing information about the database version (e.g., SqlServerVersion or PostgresVersion) so the framework can adapt its behavior to the specific RDBMS features available.

    While most operations use the globally configured Connector.Default, you can use thread-local overrides for specific blocks of code. This is useful for multi-database loading, testing, or switching connections temporarily without affecting other threads or requests.

  11. Overview of the CodeGenerator system

    master

    The CodeGenerator class serves as a facade for a suite of specialized generators designed to automate repetitive coding tasks when language limitations make manual implementation inefficient.

    Key Characteristics:

    • Runtime Execution: Generators are designed to run within the Load application. Consequently, your solution must compile successfully before you can use the code generation tools.
    • Ownership: Generated code is intended to be owned by the developer. Once generated, you should adapt and modify it to fit your specific requirements.
    • Organization: Code generation follows the existing module structure of your project, organizing output by feature rather than by technical concern.
    • Extensibility: All generator classes are self-contained and can be overridden to implement custom generation logic.
  12. What is CubeDictionary and how does it work?

    master

    A CubeDictionary is a three-dimensional, read-only data structure designed for spatial or volumetric lookups. It is the 3D equivalent of IntervalDictionary and SquareDictionary.

    Instead of single points, it uses Cube<T1, T2, T3> objects as keys, allowing you to define volumes across three dimensions. Because it is designed to be immutable, the data is provided exclusively via the constructor at creation time; there are no methods to modify the dictionary after it has been initialized.

    // Example of the conceptual structure
    // A Cube is defined by three intervals (X, Y, and Z)
    var cube = new Cube<int, int, int>(xInterval, yInterval, zInterval);