Starcounter
HomeDownloadDocsCommunity
3.0.0
3.0.0
  • Introduction
  • Database classes
  • Transactions
  • Database connection string
  • Database creation options
  • Database access with Dependency Injection (DI)
  • Running Starcounter 3.0 applications under Docker
  • Publishing Starcounter 3.0 application
  • Database types
  • Database files
  • Database processes
  • Error codes
  • star tool
  • SQL Queries
Powered by GitBook
On this page
  • List of supported .NET CLR types
  • DateTime
  • Decimal
  • String
  • Binary

Database types

PreviousPublishing Starcounter 3.0 applicationNextDatabase files

Last updated 4 years ago

Starcounter supports most of the .NET CLR primitive types.

List of supported .NET CLR types

  • Boolean

  • Byte

  • DateTime –

  • Decimal –

  • Double

  • Int16

  • Int32

  • Int64

  • SByte

  • Single

  • String –

  • UInt16

  • UInt32

  • UInt64

DateTime

Starcounter saves and returns all DateTime values in UTC.

[Database]
public abstract class Item
{
    public abstract DateTime Value { get; set; }

    public void TestDateTimeValues()
    {
        var v = new DateTime(DateTime.Now.Ticks, DateTimeKind.Local);

        // The value and the kind are converted into UTC when the CLR type
        // is converted to a database type, which happens here:
        this.Value = v;

        var kindAfter = this.Value.Kind; // System.DateTimeKind.Utc
    }
}

Starcounter does not yet support the DateTimeOffset data type.

Decimal

The Decimal values are stored as a 64-bit integer and has a precision of six decimals and a range between -4398046511103.999999 and 4398046511104.999999. Trying to store a Decimal value with higher precision or outside of the specified range will result in the following exception: ScErrCLRDecToX6DecRangeError (SCERR4246). In those cases, Double can be used if the data loss is acceptable.

String

The string data type can store data up to 1 MiB of encoded text. Thus, all strings with a length of less than 270600 will fit into the string data type. Strings with more than 270600 characters might fit depending on string content.

Starcounter does not yet support non-nullable strings.

Binary

The Binary data type is a Starcounter-defined datatype used to store binary data in the database. The maximum size of a binary field is 1 MiB.

Starcounter only supports nullable binary properties.

public abstract class Item
{
    // This defines a nullable binary property.
    // It is supported by Starcounter.
    public abstract Binary? NonNullBinary { get; set; }

    // This defines a not nullable binary property.
    // It is not yet supported by Starcounter.
    public abstract Binary NonNullBinary { get; set; }
}
limitations
limitations
limitations