Comments (3)
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.
[Key] does not work, even not without [MaxLength(31)]
from sqlitecodefirst.
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 MaxLength
set 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)
- Update to new csproj-Format
- Can I use SqliteCreateDatabaseIfNotExists within an external transaction? HOT 6
- Create, Drop and Recreate the same database HOT 5
- Nuget package for .net Core HOT 14
- Feature Request: Drop database if seed values change HOT 6
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)] for Guid HOT 2
- CASCADE verbs HOT 5
- Why need EntityFramework.SqlServer.dll? HOT 1
- EF6.4, CodeFirst 1.6, no such a table HOT 4
- Question - What are the steps required? HOT 2
- SetInitializer Instance Reference issue HOT 2
- Project Status and Release Schedule
- Create index HOT 1
- Autoincrement Fail With Key multiple HOT 4
- Feature request: Support for setting a default collation HOT 5
- Can't find by guid in iqueryable collection HOT 1
- [document enhancement] compare with Microsoft.EntityFrameworkCore.Sqlite? HOT 3
- add .NET Standard 2.0 target HOT 3
- Migration tries to create existing table HOT 17
- Always create missing tables? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlitecodefirst.