ORM mapping, configuration

 

  • Configuration section class:
public class ConfigurationSection : AppConfigurationSection
{
    public String DateFormat { getset; }
}
  • Web.config file. Replace 'ProjectName' with a proper name. For diacristics please note, that column names can be url encoded (http://www.string-functions.com/urlencode.aspx)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
    <section type="Extreme.SPFramework.Configuration.AppConfigurationProvider`1[[Extreme.[ProjectName].BusinessLogic.Configuration.ConfigurationSection, Extreme.[ProjectName].BusinessLogic]], Extreme.SPFramework.v2.0"
             name="ConfigProvider.[ProjectName]"/>
  </configSections>
  <castle />
  <ConfigProvider.[ProjectName]>
    <ConfigurationSection>
      <DateFormat>yyyy.MM.dd</DateFormat> <!-- see 'DateFormat' above. It is extremely simple to add new configuation keys -->
      <DefaultCacheTimeSpanString>00:01:00</DefaultCacheTimeSpanString> <!-- built-in property -->
       <!-- List of entities: -->

      <EntityMapping ListName="EmployeeList" EntityType="Extreme.[ProjectName].BusinessLogic.Entities.Employee, Extreme.[ProjectName].BusinessLogic">
        <PropertyMapping PropertyName="Name" ColumnName="FirstNameColumn" />
        <PropertyMapping PropertyName="BirthDate" ColumnName="DateColumn"   />
<PropertyMapping PropertyName="Superior" ColumnName="Superior column" ReadOnly="false" /> <PropertyMapping PropertyName="IsActive" ColumnName="Is active column" /> <PropertyMapping PropertyName="Priority" ColumnName="Priority" />
<
PropertyMapping PropertyName="Divisions" ColumnName="User Divisions" />
      </EntityMapping>
   
</
ConfigurationSection>
  </ConfigProvider.[ProjectName]>
</configuration>

Last edited Apr 28, 2011 at 11:54 AM by Extreme, version 7

Comments

No comments yet.