Skip to content

Custom Table Name, Priority TableAttribute.Name > CustomName > MappedType.Name #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
26 changes: 13 additions & 13 deletions Runtime/SQLiteExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public enum DeserializeFlags : uint

[DllImport(LibraryPath, EntryPoint = "sqlite3_deserialize", CallingConvention = CallingConvention.Cdecl)]
public static extern Result Deserialize(IntPtr db, [MarshalAs(UnmanagedType.LPStr)] string zSchema, byte[] pData, long szDb, long szBuf, DeserializeFlags mFlags);

[DllImport(LibraryPath, EntryPoint = "sqlite3_deserialize", CallingConvention = CallingConvention.Cdecl)]
public static unsafe extern Result Deserialize(IntPtr db, [MarshalAs(UnmanagedType.LPStr)] string zSchema, void* pData, long szDb, long szBuf, DeserializeFlags mFlags);

Expand Down Expand Up @@ -84,35 +84,35 @@ static SQLite3()

public static class ISQLiteConnectionExtensions
{
public static int Insert<T>(this ISQLiteConnection connection, ref T obj)
public static int Insert<T>(this ISQLiteConnection connection, ref T obj, string tableName = "")
{
object boxed = obj;
int result = connection.Insert(boxed);
obj = (T) boxed;
int result = connection.Insert(boxed, tableName);
obj = (T)boxed;
return result;
}

public static int Insert<T>(this ISQLiteConnection connection, ref T obj, Type objType)
public static int Insert<T>(this ISQLiteConnection connection, ref T obj, Type objType, string tableName = "")
{
object boxed = obj;
int result = connection.Insert(boxed, objType);
obj = (T) boxed;
int result = connection.Insert(boxed, objType, tableName);
obj = (T)boxed;
return result;
}

public static int Insert<T>(this ISQLiteConnection connection, ref T obj, string extra)
public static int Insert<T>(this ISQLiteConnection connection, ref T obj, string extra, string tableName = "")
{
object boxed = obj;
int result = connection.Insert(boxed, extra);
obj = (T) boxed;
int result = connection.Insert(boxed, extra, tableName);
obj = (T)boxed;
return result;
}

public static int Insert<T>(this ISQLiteConnection connection, ref T obj, string extra, Type objType)
public static int Insert<T>(this ISQLiteConnection connection, ref T obj, string extra, Type objType, string tableName = "")
{
object boxed = obj;
int result = connection.Insert(boxed, extra, objType);
obj = (T) boxed;
int result = connection.Insert(boxed, extra, objType, tableName);
obj = (T)boxed;
return result;
}
}
Expand Down
Loading