I have added the ability to used named connections to my AutoCRUD classes by implementing the IChangeDb interface, but only using the NamedConnection property.
This works fine for GET, POST and DELETE requests, but the PUT request always fails with the message ‘NamedConnection’ is not a property of ‘Channel’.
This is a sample of a POST request, which works fine:
[ProtoContract]
public class CreateChannel : ICreateDb< Channel >, IReturn< CreateChannelResponse >, IChangeDb
{
[ProtoMember( 1 )]
public string Name { get; set; }
[ProtoMember( 2 )]
public string Type { get; set; }
[ProtoMember( 3 )]
public string NamedConnection { get; set; }
}
And the DELETE request, which also works:
[ProtoContract]
public class DeleteChannel : IDeleteDb< Channel >, IReturn< DeleteChannelResponse >, IChangeDb
{
[ProtoMember( 1, DataFormat = DataFormat.ZigZag )]
public int Id { get; set; }
[ProtoMember( 2 )]
public ulong RowVersion { get; set; }
[ProtoMember( 3 )]
public string NamedConnection { get; set; }
}
And this is a sample of a PUT request, which produces the error:
[ProtoContract]
public class UpdateChannel : IUpdateDb< Channel >, IReturn< UpdateChannelResponse >, IChangeDb
{
[ProtoMember( 1, DataFormat = DataFormat.ZigZag )]
public int Id { get; set; }
[ProtoMember( 2 )]
public string Name { get; set; }
[ProtoMember( 3 )]
public string Type { get; set; }
[ProtoMember( 4 )]
public ulong RowVersion { get; set; }
[ProtoMember( 5 )]
public string NamedConnection { get; set; }
}
public interface IChangeDb
{
string NamedConnection { get; set; }
}
The exception is thrown at:
ServiceStack.OrmLite.ModelDefinition.ThrowNoFieldException(String fieldName) in C:\\BuildAgent\\work\\27e4cc16641be8c0\\src\\ServiceStack.OrmLite\\ModelDefinition.cs:line 150
Do you have any suggestions as to what I’m doing wrong?
Regards,
Alan