withfield orchard 1.4.2

2019-08-14 09:33发布

I'm new to orchard and am following http://skywalkersoftwaredevelopment.net tutorials.

ContentDefinitionManager.AlterPartDefinition(typeof(AddressPart).Name, p => p
            .Attachable(false)
            .WithField("Name", f => f.OfType(typeof(TextField).Name))
            .WithField("AddressLine1", f => f.OfType(typeof(TextField).Name))
            .WithField("AddressLine2", f => f.OfType(typeof(TextField).Name))
            .WithField("Zipcode", f => f.OfType(typeof(TextField).Name))
            .WithField("City", f => f.OfType(typeof(TextField).Name))
            .WithField("Country", f => f.OfType(typeof(TextField).Name))
            );

 SchemaBuilder.CreateTable("AddressRecord", t => t
            .ContentPartRecord()
            .Column<int>("CustomerId")
            .Column<string>("Type", c => c.WithLength(50))
            );

what does withfield really function in this case? why no createtable stuff to create real table field for addressrecord table ?

where are these "Name", "addressline1" supposed to be saved in database?

Thanks for your reading.

1条回答
对你真心纯属浪费
2楼-- · 2019-08-14 10:19

It adds fields to the Address part. Fields are lighter weight ways to extend type in Orchard. They do not get stored in their own tables but rather are serialized as XML into a single column. This is why they are easier to create, but harder to query.

查看更多
登录 后发表回答