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

SchemaBuilder.CreateTable("Persons",
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

then

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

_repository.Create(objAddressesRecord);


if someone has a better practice I would love to know it.
Developer
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.