Git Product home page Git Product logo

Comments (3)

msallin avatar msallin commented on June 8, 2024

Thank you for the suggestion.
They Key Attribute should already working.
I'll add support for the MaxLenght constrain in the next couple of days.

from sqlitecodefirst.

code1line avatar code1line commented on June 8, 2024

[Key] does not work, even not without [MaxLength(31)]

from sqlitecodefirst.

msallin avatar msallin commented on June 8, 2024

MaxLength:
You can do something like this in SQLite: Column NVARCHAR (10) this will set the maximum length to 10 but SQLite will not enforce this value (e.g. by truncating or by throwing an error).
Anyway, I implemented this feature. But I discovered the following behavoir:
If you do something like this:
[Key] [MaxLength(5)] public string LastName { get; set; }

The SQLite EF provider will ignore the value in MaxLength and set the value to 128.
So this also means that each string column which is declard as key will have the MaxLengthset to 128.

Key
I did some refactorings and changed the code SQLite DDL Code generation so that now the PrimaryKeys are defined with the "PRIMARY KEY" constraint on the table level instead of the column level. This now also makes it possible to have primary key composites. If you whish to use primary key composites, please take into account that you have to annotate the primary key properties also with the [Column(Order = 1)] Column order annotation.

See v0.1-apha.2

from sqlitecodefirst.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.