-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
IgnoreAttribute not working #586
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
Comments
Oh thanks for catching that. Have to check the tests to see why this wasn't caught. I thought |
I can't repro the bug -- Which version of .NET are you running this on? |
The code I have the database initialization in is NetStandard 1.4 and I was running it via a UWP Xamarin Forms app.
From: Frank A. Krueger [mailto:[email protected]]
Sent: Friday, July 28, 2017 3:25 PM
To: praeclarum/sqlite-net <[email protected]>
Cc: Brian Limkemann <[email protected]>; Author <[email protected]>
Subject: Re: [praeclarum/sqlite-net] IgnoreAttribute not working (#586)
I can't repro the bug -- IsDefined(..., true) works.
Which version of .NET are you running this on?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#586 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AJ6LVczjGgyT4K5v1m1nynkOQLuFsP1xks5sSjWKgaJpZM4Oj227>.
|
@praeclarum @blimkemann |
I think it is the same issue.
From: Hines Vaughan [mailto:[email protected]]
Sent: Monday, July 31, 2017 11:09 PM
To: praeclarum/sqlite-net <[email protected]>
Cc: Brian Limkemann <[email protected]>; Mention <[email protected]>
Subject: Re: [praeclarum/sqlite-net] IgnoreAttribute not working (#586)
@praeclarum<https://github.com/praeclarum> @blimkemann<https://github.com/blimkemann>
Possibly related to my post here<#549 (comment)>?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#586 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AJ6LVcHop4T12ZxESfNjUtLyGCIqc6Ljks5sTpbegaJpZM4Oj227>.
|
Here is the test code I wrote: https://github.com/praeclarum/sqlite-net/blob/master/tests/IgnoreTest.cs#L95-L126 public class BaseClass
{
[Ignore]
public string ToIgnore {
get;
set;
}
}
public class TableClass : BaseClass
{
public string Name { get; set; }
}
[Test]
public void BaseIgnores ()
{
var db = new TestDb ();
db.CreateTable<TableClass> ();
var o = new TableClass {
ToIgnore = "Hello",
Name = "World",
};
db.Insert (o);
var oo = db.Table<TableClass> ().First ();
Assert.AreEqual (null, oo.ToIgnore);
Assert.AreEqual ("World", oo.Name);
} The test passes. Is your code different? |
Have you run this test from a netstandard project that is referenced by UWP? That is my particular environment (haven’t tried other platforms yet) and I’m wondering if it’s a UWP / NetStandard issue?
From: Frank A. Krueger [mailto:[email protected]]
Sent: Tuesday, August 1, 2017 12:10 PM
To: praeclarum/sqlite-net <[email protected]>
Cc: Brian Limkemann <[email protected]>; Mention <[email protected]>
Subject: Re: [praeclarum/sqlite-net] IgnoreAttribute not working (#586)
Here is the test code I wrote: https://github.com/praeclarum/sqlite-net/blob/master/tests/IgnoreTest.cs#L95-L126
public class BaseClass
{
[Ignore]
public string ToIgnore {
get;
set;
}
}
public class TableClass : BaseClass
{
public string Name { get; set; }
}
[Test]
public void BaseIgnores ()
{
var db = new TestDb ();
db.CreateTable<TableClass> ();
var o = new TableClass {
ToIgnore = "Hello",
Name = "World",
};
db.Insert (o);
var oo = db.Table<TableClass> ().First ();
Assert.AreEqual (null, oo.ToIgnore);
Assert.AreEqual ("World", oo.Name);
}
The test passes. Is your code different?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#586 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AJ6LVesLazkyC4f5k5CD4dHCjYdShMPKks5sT03fgaJpZM4Oj227>.
|
A test case for my specific issue would look like this (though I have not actually tried running the following code myself):
When it tries to create |
OK, that's a bit different than the test (you would need the |
I have a base class that includes [Ignore] on a couple of properties. I am calling CreateTable on a derived class and the ignored properties in the base class are not being ignored.
Example:
Calling CreateTable<TableClass> creates a table with Name AND ToIgnore!
This is in a NetStandard project.
A fix involves modifying the TableMapping method as follows:
The text was updated successfully, but these errors were encountered: