This project is read-only.

webapi to database

Topics: Customizing Orchard, General, Writing modules
Mar 18, 2014 at 11:15 PM
When I have data posted to my webapi, inside orchard, that I want to persist to a database, what is the best way to do it?

If for example I had a PersonRecord, and a migration that defines the Person table like this

table => table
.Column<int>("Id", column => column.PrimaryKey().Identity())
.Column<string>("FirstName", column => column.WithLength(128))
.Column<string>("LastName", column => column.WithLength(128))
.Column<string>("NickName", column => column.WithLength(64)));

thanks in advance for any suggestions
Mar 19, 2014 at 1:26 AM
right now my best guess is the use IRepository<PersonRecord> _repository


PersonRecord myPersonRecord = new PersonRecord()
fill out fields
and last call this


if someone has a better practice I would love to know it.
Mar 19, 2014 at 2:57 AM
This is all right. In Orchard you can store data in the DB in basically two ways: as content items or as simpler records. Records are nice if you don't want to use anything that content items offer.