1
1
// ------------------------------------------------------------------------------
2
2
// <auto-generated>
3
- // This code was generated with KY.Generator 7.3.0 .0
3
+ // This code was generated with KY.Generator 7.3.1 .0
4
4
//
5
5
// Manual changes to this file may cause unexpected behavior in your application.
6
6
// Manual changes to this file will be overwritten if the code is regenerated.
15
15
16
16
namespace ToDatabase
17
17
{
18
- [ GeneratedCode ( "KY.Generator" , "7.3.0 .0" ) ]
18
+ [ GeneratedCode ( "KY.Generator" , "7.3.1 .0" ) ]
19
19
public partial class PersonRepository
20
20
{
21
21
private SqliteConnection connection ;
@@ -36,7 +36,8 @@ CREATE TABLE IF NOT EXISTS Person
36
36
LastName TEXT not null,
37
37
Birthday TEXT not null,
38
38
Age INTEGER not null,
39
- Address TEXT
39
+ Address TEXT,
40
+ Uid TEXT not null
40
41
);" ;
41
42
command . ExecuteNonQuery ( ) ;
42
43
}
@@ -52,7 +53,7 @@ public List<Person> Get(string filter = null)
52
53
{
53
54
using SqliteCommand command = this . connection . CreateCommand ( ) ;
54
55
command . CommandText = @"
55
- SELECT Id, FirstName, LastName, Birthday, Age, Address
56
+ SELECT Id, FirstName, LastName, Birthday, Age, Address, Uid
56
57
FROM Person" ;
57
58
List < Person > result = new List < Person > ( ) ;
58
59
if ( ! string . IsNullOrEmpty ( filter ) )
@@ -69,6 +70,7 @@ public List<Person> Get(string filter = null)
69
70
entry . Birthday = reader . GetDateTime ( 3 ) ;
70
71
entry . Age = reader . GetInt32 ( 4 ) ;
71
72
entry . Address = reader . IsDBNull ( 5 ) ? null : reader . GetString ( 5 ) ;
73
+ entry . Uid = reader . GetGuid ( 6 ) ;
72
74
result . Add ( entry ) ;
73
75
}
74
76
return result ;
@@ -77,13 +79,14 @@ public List<Person> Get(string filter = null)
77
79
public Int32 Insert ( Person entry )
78
80
{
79
81
using SqliteCommand command = this . connection . CreateCommand ( ) ;
80
- command . CommandText = @"INSERT INTO Person (FirstName, LastName, Birthday, Age, Address) VALUES (@firstName, @lastName, @birthday, @age, @address);
82
+ command . CommandText = @"INSERT INTO Person (FirstName, LastName, Birthday, Age, Address, Uid ) VALUES (@firstName, @lastName, @birthday, @age, @address, @uid );
81
83
SELECT last_insert_rowid();" ;
82
84
command . Parameters . Add ( new SqliteParameter ( "@firstName" , entry . FirstName ) ) ;
83
85
command . Parameters . Add ( new SqliteParameter ( "@lastName" , entry . LastName ) ) ;
84
86
command . Parameters . Add ( new SqliteParameter ( "@birthday" , entry . Birthday ) ) ;
85
87
command . Parameters . Add ( new SqliteParameter ( "@age" , entry . Age ) ) ;
86
88
command . Parameters . Add ( new SqliteParameter ( "@address" , entry . Address ?? ( object ) DBNull . Value ) ) ;
89
+ command . Parameters . Add ( new SqliteParameter ( "@uid" , entry . Uid . ToString ( ) ) ) ;
87
90
return ( Int32 ) ( long ) command . ExecuteScalar ( ) ;
88
91
}
89
92
@@ -96,14 +99,16 @@ UPDATE Person
96
99
LastName = @lastName,
97
100
Birthday = @birthday,
98
101
Age = @age,
99
- Address = @address
102
+ Address = @address,
103
+ Uid = @uid
100
104
WHERE Id = @id" ;
101
105
command . Parameters . Add ( new SqliteParameter ( "@id" , entry . Id ) ) ;
102
106
command . Parameters . Add ( new SqliteParameter ( "@firstName" , entry . FirstName ) ) ;
103
107
command . Parameters . Add ( new SqliteParameter ( "@lastName" , entry . LastName ) ) ;
104
108
command . Parameters . Add ( new SqliteParameter ( "@birthday" , entry . Birthday ) ) ;
105
109
command . Parameters . Add ( new SqliteParameter ( "@age" , entry . Age ) ) ;
106
110
command . Parameters . Add ( new SqliteParameter ( "@address" , entry . Address ?? ( object ) DBNull . Value ) ) ;
111
+ command . Parameters . Add ( new SqliteParameter ( "@uid" , entry . Uid ) ) ;
107
112
command . ExecuteNonQuery ( ) ;
108
113
}
109
114
0 commit comments