コード例 #1
0
ファイル: GalaxyRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<Planemo> map)
 {
     map.AsUriBaseType();
     map.AsChildResourceOf(x => x.PlanetarySystem, x => x.Planets);
     map.PostAllowed();
     map.DeleteAllowed();
 }
コード例 #2
0
 public void Map(ITypeMappingConfigurator <Critter> map)
 {
     map.AsUriBaseType()
     .Include(x => x.CrazyValue)
     .Include(x => x.CreatedOn)
     .Include(x => x.Subscriptions, o => o.Expand().Writable())
     .Include(x => x.HandledGeneratedProperty, o => o.OnQuery(x => x.Id % 6))
     .Include(x => x.Password, o => o.WithAccessMode(HttpMethod.Post | HttpMethod.Put))
     .Include(x => x.PublicAndReadOnlyThroughApi, o => o.ReadOnly())
     .Include(x => x.PropertyWithAttributeAddedFluently, o => o.HasAttribute(new ObsoleteAttribute()))
     .IncludeAs <string>(x => x.IntExposedAsString,
                         o =>
                         o.OnGet(x => x.IntExposedAsString.ToString()).OnQuery(x => x.IntExposedAsString.ToString())
                         .OnSet((c, v) => c.IntExposedAsString = int.Parse(v)))
     .Include(x => x.Weapons, o => o.Writable())
     .Include(x => x.RelativeImageUrl,
              o => o.Named("AbsoluteImageUrl")
              .OnGet <NancyContext>((critter, ctx) =>
     {
         var absUrl   = ctx.Request.Url.Clone();
         absUrl.Path  = critter.RelativeImageUrl;
         absUrl.Query = null;
         return(absUrl.ToString());
     })
              .OnSet <NancyContext>(
                  (critter, value, ctx) =>
     {
         critter.RelativeImageUrl =
             new Uri(value).AbsolutePath.Substring((ctx.Request.Url.BasePath ?? "").Length);
     }))
     .Include(x => x.Enemies, o => o.ExpandShallow())
     .HandledBy <CritterHandler>()
     .OnDeserialized(c => c.FixParentReferences());
 }
コード例 #3
0
ファイル: GalaxyRules.cs プロジェクト: anthrax3/Pomona
 public void Map(ITypeMappingConfigurator <Planemo> map)
 {
     map.AsUriBaseType();
     map.AsChildResourceOf(x => x.PlanetarySystem, x => x.Planets);
     map.PostAllowed();
     map.DeleteAllowed();
 }
コード例 #4
0
 public void Map(ITypeMappingConfigurator <StringToObjectDictionaryContainer> map)
 {
     // SAMPLE: map-property-as-attributes
     map.Include(x => x.Map, o => o.AsAttributes());
     // ENDSAMPLE
     map.Include(x => x.ETag, o => o.AsEtag());
 }
コード例 #5
0
ファイル: GalaxyRules.cs プロジェクト: anthrax3/Pomona
 public void Map(ITypeMappingConfigurator <PlanetarySystem> map)
 {
     map.AsUriBaseType()
     .Include(x => x.Planets,
              o => o.ExposedAsRepository().Allow(HttpMethod.Post).ItemsAllow(HttpMethod.Delete))
     .HasChild(x => x.Star, x => x.PlanetarySystem)
     .AsChildResourceOf(x => x.Galaxy, x => x.PlanetarySystems);
 }
コード例 #6
0
ファイル: GalaxyRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<PlanetarySystem> map)
 {
     map.AsUriBaseType()
        .Include(x => x.Planets,
                 o => o.ExposedAsRepository().Allow(HttpMethod.Post).ItemsAllow(HttpMethod.Delete))
        .HasChild(x => x.Star, x => x.PlanetarySystem)
        .AsChildResourceOf(x => x.Galaxy, x => x.PlanetarySystems);
 }
コード例 #7
0
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-include-property-onget-onset-onquery
        public void IncludePropertyWithCustomAccessors(ITypeMappingConfigurator <Customer> customer)
        {
            customer
            .Include(x => x.Name, x => x
                     .OnGet(y => y.Name.ToUpper())
                     .OnSet((c, v) => c.Name = v.ToLower())
                     .OnQuery(y => y.Name.ToUpper()));
        }
コード例 #8
0
 public void Map(ITypeMappingConfigurator <Loner> map)
 {
     map.ConstructedUsing(
         (c) =>
         new Loner(c.Requires().Name,
                   c.Requires().Strength,
                   c.Optional().OptionalInfo,
                   c.Optional().OptionalDate));
 }
コード例 #9
0
ファイル: GalaxyRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<Planet> map)
 {
     map.HasChildren(x => x.Moons,
                     x => x.Planet,
                     x => x.AsUriBaseType()
                           .ConstructedUsing(y => new Moon(y.Requires().Name, y.Parent<Planet>())),
                     x => x.Writable());
     map.ConstructedUsing(x => new Planet(x.Requires().Name, x.Parent<PlanetarySystem>()));
 }
コード例 #10
0
ファイル: GalaxyRules.cs プロジェクト: anthrax3/Pomona
 public void Map(ITypeMappingConfigurator <Planet> map)
 {
     map.HasChildren(x => x.Moons,
                     x => x.Planet,
                     x => x.AsUriBaseType()
                     .ConstructedUsing(y => new Moon(y.Requires().Name, y.Parent <Planet>())),
                     x => x.Writable());
     map.ConstructedUsing(x => new Planet(x.Requires().Name, x.Parent <PlanetarySystem>()));
 }
コード例 #11
0
 public void Map(ITypeMappingConfigurator <IExposedInterface> map)
 {
     map
     .Named("ExposedInterface")
     .AsUriBaseType()
     .WithPluralName("ExposedInterfaces")
     .Include(x => x.PropertyFromInheritedInterface)
     .AsConcrete()
     .ConstructedUsing(c => new ExposedInterfaceInternalImplementation());
 }
コード例 #12
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<IExposedInterface> map)
 {
     map
         .Named("ExposedInterface")
         .AsUriBaseType()
         .WithPluralName("ExposedInterfaces")
         .Include(x => x.PropertyFromInheritedInterface)
         .AsConcrete()
         .ConstructedUsing(c => new ExposedInterfaceInternalImplementation());
 }
コード例 #13
0
ファイル: GalaxyRules.cs プロジェクト: BeeWarloc/Pomona
 public void Map(ITypeMappingConfigurator<Planet> map)
 {
     map.AsUriBaseType();
     map.HasChildren(x => x.Moons,
         x => x.Planet,
         x => x.AsUriBaseType()
             .AsChildResourceOf(y => y.Planet, y => y.Moons)
             .ConstructedUsing(y => new Moon(y.Requires().Name, y.Parent<Planet>())), x => x);
     map.AsChildResourceOf(x => x.PlanetarySystem, x => x.Planets)
         .ConstructedUsing(x => new Planet(x.Requires().Name, x.Parent<PlanetarySystem>()))
         .Include(x => x.Moons, o => o.Writable());
 }
コード例 #14
0
 public void Map(ITypeMappingConfigurator <VirtualPropertyThing> map)
 {
     map
     .Include <string>("Rocky",
                       o => o.OnGetAndQuery(x => x.Items.SafeGet("Rocky") ?? "BALOBA")
                       .OnSet((x, v) => x.Items["Rocky"] = v)
                       .Writable())
     .Include <double>("NumberSquareRoot",
                       o => o.OnGetAndQuery(x => Math.Sqrt(x.Number))
                       .OnSet((x, v) => x.Number = v * v)
                       .Writable());
 }
コード例 #15
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<HandledThing> map)
 {
     map
         .HasChildren(x => x.Children,
                      x => x.Parent,
                      t =>
                      {
                          return
                              t.ConstructedUsing(c => new HandledChild(c.Parent<HandledThing>()))
                               .HandledBy<HandledThingsHandler>();
                      },
                      o => o.ExposedAsRepository())
         .Include(x => x.ETag, o => o.AsEtag())
         .AsUriBaseType()
         .DeleteAllowed().HandledBy<HandledThingsHandler>();
 }
コード例 #16
0
 public void Map(ITypeMappingConfigurator <HandledThing> map)
 {
     map
     .HasChildren(x => x.Children,
                  x => x.Parent,
                  t =>
     {
         return
         (t.ConstructedUsing(c => new HandledChild(c.Parent <HandledThing>()))
          .HandledBy <HandledThingsHandler>());
     },
                  o => o.ExposedAsRepository())
     .Include(x => x.ETag, o => o.AsEtag())
     .AsUriBaseType()
     .DeleteAllowed().HandledBy <HandledThingsHandler>();
 }
コード例 #17
0
            public void Map(ITypeMappingConfigurator <TestEntityBase> map)
            {
                map.Include(x => x.Id);
                map.Include(x => x.ToBeOverridden);

                switch (this.defaultPropertyInclusionMode)
                {
                case null:
                    break;

                case DefaultPropertyInclusionMode.AllPropertiesRequiresExplicitMapping:
                    map.AllPropertiesRequiresExplicitMapping();
                    break;

                case DefaultPropertyInclusionMode.AllPropertiesAreIncludedByDefault:
                    map.AllPropertiesAreIncludedByDefault();
                    break;

                case DefaultPropertyInclusionMode.AllPropertiesAreExcludedByDefault:
                    map.AllPropertiesAreExcludedByDefault();
                    break;
                }
            }
コード例 #18
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-exclude-property-fluent-rule
        public void ExcludeRule(ITypeMappingConfigurator<Customer> customer)
        {
            customer.Exclude(x => x.Password);
        }
コード例 #19
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-plural-name-fluent-rule
        public void PluralNameRule(ITypeMappingConfigurator<Mouse> mouse)
        {
            mouse.WithPluralName("Mice");
        }
コード例 #20
0
 public void Map(ITypeMappingConfigurator <ThingIndependentFromBase> map)
 {
     map.AsIndependentTypeRoot();
 }
コード例 #21
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
 // SAMPLE: misc-constructed-using-fluent-rule
 public void ConstructedUsingRule(ITypeMappingConfigurator<Customer> customer)
 {
     customer.ConstructedUsing(c => new Customer(c.Requires().Name, c.Optional().Password));
 }
コード例 #22
0
 public void Map(ITypeMappingConfigurator <UnpatchableThing> map)
 {
     map.PatchDenied();
 }
コード例 #23
0
 public void Map(ITypeMappingConfigurator <MusicalCritter> map)
 {
     map.ConstructedUsing((c) => new MusicalCritter(c.Optional().OnlyWritableByInheritedResource));
 }
コード例 #24
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<UnpostableThingOnServer> map)
 {
     map.WithPluralName("UnpostableThingsOnServer");
     map.PostDenied();
 }
コード例 #25
0
ファイル: GuidThingFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<GuidThing> map)
 {
     map.HandledBy<GuidThingHandler>().ConstructedUsing(c => new GuidThing(null));
 }
コード例 #26
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<MusicalCritter> map)
 {
     map.ConstructedUsing((c) => new MusicalCritter(c.Optional().OnlyWritableByInheritedResource));
 }
コード例 #27
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<UnpatchableThing> map)
 {
     map.PatchDenied();
 }
コード例 #28
0
 public void Map(ITypeMappingConfigurator <Subscription> map)
 {
     map.AsValueObject();
     map.Exclude(x => x.Critter);
 }
コード例 #29
0
 public void Map(ITypeMappingConfigurator <ErrorStatus> map)
 {
     map.AsValueObject();
 }
コード例 #30
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<NoPrimaryKeyThing> map)
 {
     
 }
コード例 #31
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-include-property-named
        public void IncludePropertyNamed(ITypeMappingConfigurator<Customer> customer)
        {
            customer.Include(x => x.Identifier, x => x.Named("Id"));
        }
コード例 #32
0
 public void Map(ITypeMappingConfigurator <HasReadOnlyDictionaryProperty> map)
 {
     map.Include(x => x.Map,
                 o =>
                 o.AsAttributes().WithAccessMode(HttpMethod.Get | HttpMethod.Patch | HttpMethod.Post));
 }
コード例 #33
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<UnpostableThing> map)
 {
     map.PostDenied();
 }
コード例 #34
0
 // SAMPLE: etag-fluent-rule
 public void Map(ITypeMappingConfigurator <EtaggedEntity> map)
 {
     map.Include(x => x.ETag, o => o.AsEtag());
 }
コード例 #35
0
 public void Map(ITypeMappingConfigurator <OrderResponse> map)
 {
     map.AsValueObject();
 }
コード例 #36
0
        // ENDSAMPLE

        #endregion


        public void Map(ITypeMappingConfigurator <CritterCaptureCommand> map)
        {
            map.AsValueObject();
        }
コード例 #37
0
 public void Map(ITypeMappingConfigurator <NoPrimaryKeyThing> map)
 {
 }
コード例 #38
0
 public void Map(ITypeMappingConfigurator <Gun> map)
 {
     map.ConstructedUsing(x => new Gun(x.Requires().Model))
     .Include(x => x.ExplosionFactor);
 }
コード例 #39
0
 public void Map(ITypeMappingConfigurator <JunkWithRenamedProperty> map)
 {
     map.Include(x => x.ReallyUglyPropertyName, o => o.Named("BeautifulAndExposed"));
 }
コード例 #40
0
ファイル: Program.cs プロジェクト: BeeWarloc/Pomona
 public void Map(ITypeMappingConfigurator<UnpostableThingOnServer> map)
 {
     map.PostAllowed();
 }
コード例 #41
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-expand-property
        public void ExpandProperty(ITypeMappingConfigurator<Customer> customer)
        {
            customer
                .Include(x => x.Address, x => x.Expand(ExpandMode.Full));
        }
コード例 #42
0
ファイル: CritterFluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<AbstractAnimal> map)
 {
     map.Include(x => x.PublicAndReadOnlyThroughApi, o => o.ReadOnly());
 }
コード例 #43
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-contextful-construction-fluent-rule
        public void ContextfulConstructionRule(ITypeMappingConfigurator<Customer> customer)
        {
            customer.ConstructedUsing(
                c => c.Context<ICustomerFactory>()
                      .CreateCustomer(c.Requires().Name, c.Optional().Password));
        }
コード例 #44
0
 public void Map(ITypeMappingConfigurator <RenamedThing> map)
 {
     map.Named("GotNewName").WithPluralName("ThingsWithNewName").ExposedAt("renamings");
 }
コード例 #45
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-handled-by-fluent-rule
        public void HandlerRule(ITypeMappingConfigurator<Customer> customer)
        {
            customer.HandledBy<CustomerHandler>();
        }
コード例 #46
0
 public void Map(ITypeMappingConfigurator <UnhandledThing> map)
 {
     // HandledThingsHandler got not matching methods for unhandled thing. Which means request should be passed to the DataSource instead.
     map.HandledBy <HandledThingsHandler>();
 }
コード例 #47
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-value-object-fluent-rule
        public void ValueObjectRule(ITypeMappingConfigurator<Customer> customer)
        {
            customer.AsValueObject();
        }
コード例 #48
0
ファイル: GalaxyRules.cs プロジェクト: BeeWarloc/Pomona
 public void Map(ITypeMappingConfigurator<CelestialObject> map)
 {
     map.AsIndependentTypeRoot()
         .Include(x => x.Name, o => o.AsPrimaryKey())
         .Include(x => x.ETag, o => o.AsEtag().ReadOnly());
 }
コード例 #49
0
ファイル: MoreRules.cs プロジェクト: Pomona/Pomona
        // ENDSAMPLE

        #endregion

        #region sample

        // SAMPLE: misc-include-property-onget-onset-onquery
        public void IncludePropertyWithCustomAccessors(ITypeMappingConfigurator<Customer> customer)
        {
            customer
                .Include(x => x.Name, x => x
                    .OnGet(y => y.Name.ToUpper())
                    .OnSet((c, v) => c.Name = v.ToLower())
                    .OnQuery(y => y.Name.ToUpper()));
        }
コード例 #50
0
ファイル: GalaxyRules.cs プロジェクト: BeeWarloc/Pomona
 public void Map(ITypeMappingConfigurator<Galaxy> map)
 {
     map.AsUriBaseType()
         .Include(x => x.PlanetarySystems, o => o.ExposedAsRepository());
 }
コード例 #51
0
ファイル: GalaxyRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<Star> map)
 {
     map.AsChildResourceOf(x => x.PlanetarySystem, x => x.Star);
 }
コード例 #52
0
ファイル: FluentRules.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<Customer> map)
 {
     map.Exclude(x => x.Password);
     map.Include(x => x.Name);
     map.Include(x => x.Identifier, o => o.AsPrimaryKey());
 }
コード例 #53
0
 public void Map(ITypeMappingConfigurator <UnpostableThing> map)
 {
     map.PostDenied();
 }
コード例 #54
0
 public void Map(ITypeMappingConfigurator <ArgNullThrowingThing> map)
 {
     // This should throw ArgumentNullException on creation if Incoming property is null,
     // for testing that this turns into a ValidationException.
     map.ConstructedUsing(x => new ArgNullThrowingThing(x.Optional().Incoming));
 }
コード例 #55
0
ファイル: GalaxyRules.cs プロジェクト: BeeWarloc/Pomona
 public void Map(ITypeMappingConfigurator<PlanetarySystem> map)
 {
     map.AsUriBaseType()
         .Include(x => x.Planets, o => o.ExposedAsRepository())
         .AsChildResourceOf(x => x.Galaxy, x => x.PlanetarySystems);
 }
コード例 #56
0
 public void Map(ITypeMappingConfigurator <AbstractAnimal> map)
 {
     map.Include(x => x.PublicAndReadOnlyThroughApi, o => o.ReadOnly());
 }
コード例 #57
0
 public void Map(ITypeMappingConfigurator <UnpostableThingOnServer> map)
 {
     map.WithPluralName("UnpostableThingsOnServer");
     map.PostDenied();
 }
コード例 #58
0
ファイル: PomonaModuleTests.cs プロジェクト: Pomona/Pomona
 public void Map(ITypeMappingConfigurator<Dummy> map)
 {
     map.HandledBy<DummyHandler>();
 }
コード例 #59
0
ファイル: Program.cs プロジェクト: BeeWarloc/Pomona
 public void Map(ITypeMappingConfigurator<Critter> map)
 {
     map.Include(x => x.PublicAndReadOnlyThroughApi, o => o.ReadOnly());
 }
コード例 #60
0
 public void Map(ITypeMappingConfigurator <HandledSingleChild> map)
 {
     map.AsChildResourceOf(x => x.HandledThing, x => x.SingleChild);
 }