dblinq

Can't delete child entities with DbLinq

孤人 提交于 2020-01-17 03:35:08
问题 This question is related to my previous one. You can find pretty much all the code there, with the exceptions reported here. I replaced nullable fields with int fields and where the generated code put null I put -1. In this way I managed to solve an annoying exception raised by the DbLinq code. But now I can't delete child entities! In particular, I have a patient with some addresses associated. The table PatientAddresses holds all the addresses in triplets (PatientID, Address, DomicileStatus

DbLinq and Mono 2.4: Working Together?

可紊 提交于 2019-12-24 07:43:32
问题 Hopefully this is a silly question and there's really a simple solution somewhere out there but... Has anybody successfully gotten DbLinq to play nicely with Mono 2.4 on Mac OS X 10.5? I've got my SQLite database ready but for the life of me, I can't find sqlmetal to generate my objects. I'm guessing I might have to download a previous version of Mono that included sqlmetal, build and install it, and then just use the code generated from that version on Mono 2.4...but I'm hoping to avoid it

Equal is not defined between type Nullable<Int32> and Int32

别来无恙 提交于 2019-12-20 04:23:28
问题 I am writing a boring application to manage patients and their clinic history. I used SQLite combined with DbLinq libraries and DbMetal code generation utility. Here are two classes from the genereated code extracted from the underlying database: [Table(Name="main.Patients")] public partial class Patient : System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged { private static System.ComponentModel.PropertyChangingEventArgs emptyChangingEventArgs = new

DbLinq - Cache problem

社会主义新天地 提交于 2019-12-12 01:15:02
问题 I'm using linq to sql for MySql (using DbLinq) in an ASP.NET MVC website. I have a weird caching problem. Consider the following methods in my Repository class: public IEnumerable<Message> GetInbox(int userId) { using(MyDataContext repo = new MyDataContext(new MySqlConnection("[Connectionstring]"))) { return repo.Messages.Where(m => m.MessageTo == userId); } } public IEnumerable<Message> GetOutbox(int userId) { using (MyDataContext repo = new MyDataContext(new MySqlConnection("

DbMetal chokes on repeated foreign key references in SQLite - any ideas?

为君一笑 提交于 2019-12-11 07:52:17
问题 I've been struggling to get DbMetal to process my SQLite database. I finally isolated the problem. It won't allow a table to have two foreign key references to the same column. For example, a SQLite database with these two tables will fail: CREATE TABLE Person ( Id INTEGER PRIMARY KEY, Name TEXT NOT NULL ); CREATE TABLE Match ( Id INTEGER PRIMARY KEY, WinnerPersonId INTEGER NOT NULL REFERENCES Person(Id), LoserPersonId INTEGER NOT NULL REFERENCES Person(Id) ); I get this error: DbMetal:

Why are binary Guids different from usual representation

断了今生、忘了曾经 提交于 2019-12-10 15:30:33
问题 I have the following Guid: AAB13E97-449B-4D5B-BDE2-AC479C31B782 Using System.Guid + DbLinq + SQLite to store it the following field is added to the database. 973EB1AA-9B44-5B4D-BDE2-AC479C31B782 (Dashes added for clarity) I can see that the last 8 bytes are in the same order, and the 3 first groups are reversed, but I don't understand why. 回答1: Looking at Wikipedia's article on the subject it says: Data4 stores the bytes in the same order as displayed in the GUID text encoding (see below),

Create Records with Linq to SQLite via DbLinq

我们两清 提交于 2019-12-07 21:56:54
问题 I have (after some significant effort) gotten DbLinq working with the latest build of Mono on OS X. Has anybody successfulyl created database entities via DbLinq/Sqlite? For example, I have the following table: CREATE TABLE UserType ( id integer primary key, description text ) I have generated my *.cs file and am using the following code to attempt to create a new UserType entry: UserType newUserType = new UserType(); newUserType.id = null // Attempting to get SQLite to increment newUserType

DBLinq not generating where clause

送分小仙女□ 提交于 2019-12-07 16:12:33
问题 I'm testing out DBLinq-0.18 and DBLinq from SVN Trunk with MySQL and Postgresql. I'm only using a very simple query but on both database DBLinq is not generating a Where clause. I have confirmed this by turning on statement logging on Postgresql to check exactly what request DBLinq is sending. My Linq query is: MyDB db = new MyDB(new NpgsqlConnection("Database=database;Host=localhost;User Id=postgres;Password=password")); var customers = from customer in db.Customers where customer

Create Records with Linq to SQLite via DbLinq

廉价感情. 提交于 2019-12-06 09:11:54
I have (after some significant effort) gotten DbLinq working with the latest build of Mono on OS X. Has anybody successfulyl created database entities via DbLinq/Sqlite? For example, I have the following table: CREATE TABLE UserType ( id integer primary key, description text ) I have generated my *.cs file and am using the following code to attempt to create a new UserType entry: UserType newUserType = new UserType(); newUserType.id = null // Attempting to get SQLite to increment newUserType.description = "Administrator"; db.UserType.InsertOnSubmit(newUserType); db.SubmitChanges(); The call to

DBLinq not generating where clause

谁都会走 提交于 2019-12-06 02:56:35
I'm testing out DBLinq-0.18 and DBLinq from SVN Trunk with MySQL and Postgresql. I'm only using a very simple query but on both database DBLinq is not generating a Where clause. I have confirmed this by turning on statement logging on Postgresql to check exactly what request DBLinq is sending. My Linq query is: MyDB db = new MyDB(new NpgsqlConnection("Database=database;Host=localhost;User Id=postgres;Password=password")); var customers = from customer in db.Customers where customer.CustomerUserName == "test" select customer; The query works ok but the SQL generated by DBLinq is of the form: