CodeMash
  • 🚀Backend as a service
  • 🦄Roadmap
  • 🍕Release Notes
  • Installation
    • Managed Service
    • 🏗️AWS-CDK
    • 🏗️Azure
    • 🏗️Docker
    • 🏗️GC
    • 🏗️Terraform
  • dashboard
    • CodeMash Cloud
    • Project
    • Membership
      • Users
      • Roles
      • Policies
      • Triggers
      • Integrations
        • Apple
        • Azure
        • Facebook
        • Google
        • Twitter
      • Settings
    • Database
      • Collections
        • Schema
          • From Template
          • Structure
        • Tabs
        • Triggers
        • Indexes
        • Shared Forms
      • Taxonomies
        • Terms
        • Schema
        • Settings
      • Aggregation
      • Imports
      • Exports
      • Backups
    • Files
      • Integrations
        • CodeMash
        • S3 Bucket
    • Notifications
      • Push
        • Push Templates
        • Push Templates API
        • Push Notifications
        • Push Notifications API
        • Devices
        • Devices API
        • Integrations
          • Firebase
          • One Signal
          • Expo
      • Email
        • Email Templates
        • Emails
        • Integrations
          • AWS SES
          • Twilio Sendgrid
          • Mailgun
      • 🏗️Server events
      • 🏗️Sms
    • Payments
      • Integrations
        • Apple Pay
        • Google Pay
        • Stripe
        • Kevin.
        • Paysera
        • Decta
    • Scheduler
    • Logs & Monitoring
    • Code
      • Functions
        • Function Inputs
        • Function Templates
          • Node.js
          • Python
          • Ruby
          • Java
          • Go
          • .NET Core
      • CodeMash Functions
        • Google Functions
          • Google Calendar
          • Google Gmail
        • Microsoft Functions
          • Microsoft 365 Users
          • Microsoft 365 Calendar
        • Collection Find
        • Collection Update
        • Users Find
        • Image Resize
        • Html To Pdf
        • Word Document
        • Barcode
        • QR Code
        • Send Email
        • Send Notification
        • Email Reminder
        • Notification Reminder
      • Integrations
        • AWS Lambda
        • Google Cloud Functions
        • Azure Functions
  • Other Topics
    • Apple
      • Developer Portal
      • Bundle Identifier
      • Team ID
      • Service ID
      • Key ID
    • Triggers
    • Tokens Binding
      • Project Tokens
      • Initiator Tokens
      • Receiver Tokens
      • Request Tokens
      • Operation based tokens
      • Template Functions
    • Search parameters
      • Paging
      • Filter
      • Sort
      • Projection
    • data-models
    • Errors
  • SDK
    • Node.js
    • TypeScript
    • .NET
    • 🏗️Go Lang
    • 🏗️Flutter
    • 🏗️Swift
    • 🏗️Kotlin
  • CLI
    • 🏗️CodeMash CLI
  • API
    • Get Started
    • Prerequisites
    • How to test?
    • Cors
    • Project
    • Membership
      • Authentication
      • Users
    • Database
      • Collections
        • Aggregate
        • Change Responsibility
        • Count
        • Delete
        • Delete Many
        • Distinct
        • Find
        • Find One
        • Insert
        • Insert Many
        • References
        • Replace
        • Update
        • Update Many
      • Taxonomies
        • Find
    • Files
    • Code
    • Notifications
      • Push
      • Emails
      • Server Events
      • 🏗️Sms
    • Payments
    • Scheduler
    • Logs & Monitoring
Powered by GitBook
On this page
  • Get Started
  • Database
  • Entities

Was this helpful?

Edit on GitHub
  1. SDK

.NET

.NET SDK for CodeMash API

The database and other services we do provide have REST API on top of it. So each interaction and much more are available using our robust API. (Please check the API documentation section).

Even though working with API can be less joyful than having a well-prepared SDK (Software Development Kit) for your programming language. For this reason, we provide ready-to-production Microsoft. NET SDK that allows you to quickly handle tedious tasks and focus more on your app.

Prerequisites.

Before you jump in, please make sure you have CodeMash API Key.

Get Started

Install CodeMash via NuGet Package manager

Using your preferred editor (Visual Studio, JetBrains Rider, Visual Studio Code, or any other), open your .NET project. Add CodeMash.Code NuGet Package using one of the following ways:

  1. Visual Studio (For more info on how to install the package in Visual Studio, you can find it here.)

    1. Load a project in Solution Explorer, and then select Project > Manage NuGet Packages.

    2. Find CodeMash.Core package and install it.

  2. dotnet CLI (For more info on how to install the package in Visual Studio, you can find it here.)

# using dotnet CLI
dotnet add package CodeMash.Core

You can find the CodeMash npm package here.

Download from source code

Source code is available at https://github.com/codemash-io/CodeMash.Net

You can go to the Releases section and download the build version from the release assets.

Database

Collections

Entities

Entities are your collection data models. In object-oriented programming, this would be a class that is a representation of a collection in your code. Our SDKs provide helper tools to make this representation easier to handle.

Attributes

  • [Collection] - used on a class to specify the name of a collection that this class represents.

  • [Field] - used on property inside of a class to specify the name that is used inside a database. That would be a unique name that you see in your dashboard, collection page, field configuration.

[Collection("persons")]
public class Person : Entity
{
    [Field("name")]
    public string Name { get; set; }
}

The collection attribute allows your requests to the database to be automatically injected with a collection name. The field attribute allows us to correctly serialize and parse your records, filter, sort, projection, and update queries. You can omit this attribute if your property name is exactly the same as your field's unique name.

Interfaces

  • IEntity - an interface that every entity class should implement. This will allow us to use the class in provided database methods.

Classes

  • Entity - a class that already implements IEntity interface and can be extended by your entity classes.

  • TermEntity - a class that should be used for taxonomy references (if your collection has references to taxonomies, use this class for that field).

  • FileEntity - a class that should be used for file fields.

PreviousTypeScriptNextGo Lang

Last updated 2 years ago

Was this helpful?

Find