npoco


NPoco mapping primarykey error


I am experimenting with NPoco and immediately ran into an issue with a primary key error. I'm using the class below and the database table is called tblSessionInfo. If I create a new SessionInfo and attempt to save it I get "The object doesn't have a property matching the primary key column name 'ID'". If I retrieve a record from the db and inflate a SessionInfo and then try to save it I get "The object doesn't have a property matching the primary key column name 'ID'". It seems that NPoco is not acknowledging the PrimaryKey attribute. When I debug my code I can step through the Column attribute bindings never the PrimaryKey attribute binding though. I pulled the attribute classes from PetaPoco's implementation.
[TableName("tblSessionInfo")]
[PrimaryKey("SessionId")]
[ExplicitColumns]
public class SessionInfo
{
#region Properties
public int SessionId { get; set; }
[Column("SessionCreated")]
public DateTime? SessionCreated { get; set; }
[Column("SessionUpdated")]
public DateTime? SessionUpdated { get; set; }
[Column("SessionEnded")]
public DateTime? SessionEnded { get; set; }
[Column("SessionData")]
public string SessionData { get; set; }
[Column("ApplicationId")]
public int? ApplicationId { get; set; }
[Column("Expired")]
public bool? Expired { get; set; }
#endregion
}

Related Links

NPoco mapping primarykey error
Nopoc Execute() method returns -1
Creating a new database using NPoco
Creating Custom Ignore attribute only for Update methods?
NPoco One-To-Many and Many-To-Many
Any example of using join in query applyable for npoco
How do I format a query to fetch an aggregate root with just related ids

Categories

HOME
c#
repository
google-cloud-pubsub
system-calls
ssh
locale
cryengine
mingw
grid
uml-designer
richtextbox
flowtype
open-search-server
osx-yosemite
rename
runtime
oms
suitecrm
websharper
saucelabs
repeater
airbnb
md2
loader
accordion
summernote
url-parameters
coccinelle
procedural-generation
v4l2
uipath
struts
orgchart
federated
undo
wordpress-rest-api
unity3d-5
kepserverex
stencyl
pygraphviz
server-side-swift
ssdp
socketcluster
vertical-alignment
glide-image-library
reqif
noise
visualizer
px4
totalview
printer-control-language
tsc
robotc
msiexec
spring-social-twitter
ownership
android-tabs
mongodb-3.3
alfred
ldd
falcon
objectify
android-xmlpullparser
angularfire
periodic-processing
firefox-os
jsondoc
oryx
google-finance-api
play-json
persian
pdcurses
android-networking
page-refresh
opennebula
valdr-bean-validation
uiblureffect
information-hiding
go-gin
formbuilder
vundle
scjp
sigma-grid-control
enquire.js
farpoint-spread
power-management
android-jack-and-jill
mdp
surfaceview
xcode5.1
record-locking
qmainwindow
bho
gwt2
gpl
nsregularexpression
waveout
animationdrawable
wxperl
youtube.net-api
moss2007-security
rollover
zend-acl
bootstrap-protocol

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App