资 源 简 介
1- Derive a partial class from ActiveRecordBase
, ActiveRecordValidationBase
.
2- Derive all model classes from that class.
3- Place the Sluggable.cs file with your models.
4- In the Sluggable.cs file, change the class name MyActiveRecord
to match
the class from step 1 and the namespace to match the models.
5- In the models you want sluggable, add the Sluggable Attribute:
[Sluggable("ProposalProperty", "SlugProperty", "ScopeProperty", "Separator")]
for example:
[Sluggable("Title", "Identifier", "Author", "-")]
This means a slug will be generated from Title and placed in Identifier.
The slug will be unique in the scope of ScopeProperty.
It will replace all foreign characters and all characters not in a to z, 0 to 9
by separator and change to lower case.
Duplicates will be appended a number