Beispiel #1
0
        protected AssociationSpecAbstract(IMetamodelManager metamodel, IAssociationSpecImmutable association, ISession session, ILifecycleManager lifecycleManager, INakedObjectManager manager)
            : base(association.Identifier.MemberName, association, session, lifecycleManager, metamodel) {
            Assert.AssertNotNull(manager);

            this.manager = manager;
            returnSpec = MetamodelManager.GetSpecification(association.ReturnSpec);
        }
        protected AssociationSpecAbstract(IMetamodelManager metamodel, IAssociationSpecImmutable association, ISession session, ILifecycleManager lifecycleManager, INakedObjectManager manager)
            : base(association.Identifier.MemberName, association, session, lifecycleManager, metamodel)
        {
            Assert.AssertNotNull(manager);

            this.manager = manager;
            returnSpec   = MetamodelManager.GetSpecification(association.ReturnSpec);
        }
Beispiel #3
0
        public static void Compare(IAssociationSpecImmutable field1, IAssociationSpecImmutable field2)
        {
            var specName = field1.Name;

            Compare(field1.OwnerSpec, field2.OwnerSpec);
            Compare(field1.ReturnSpec, field2.ReturnSpec);
            Compare(field1.Description, field2.Description, specName);
            Compare(field1.Name, field2.Name, specName);

            Compare(field1, field2, specName);
        }
        public static void Compare(IAssociationSpecImmutable field1, IAssociationSpecImmutable field2, string ownerName)
        {
            var specName = ownerName + ":" + field1.Name;

            Compare(field1.Name, field2.Name, specName);
            Compare(field1.Description, field2.Description, specName);
            Compare(field1.OwnerSpec, field2.OwnerSpec);
            Compare(field1.ReturnSpec, field2.ReturnSpec);

            Compare(field1 as IMemberSpecImmutable, field2, specName);
        }
Beispiel #5
0
 public IAssociationSpec CreateAssociation(IAssociationSpecImmutable specImmutable) {
     Assert.AssertNotNull(framework);
     var oneToOneAssociationSpecImmutable = specImmutable as IOneToOneAssociationSpecImmutable;
     if (oneToOneAssociationSpecImmutable != null) {
         return new OneToOneAssociationSpec(framework.MetamodelManager, oneToOneAssociationSpecImmutable, framework.Session, framework.LifecycleManager, framework.NakedObjectManager, framework.Persistor, framework.TransactionManager);
     }
     var oneToManyAssociationSpecImmutable = specImmutable as IOneToManyAssociationSpecImmutable;
     if (oneToManyAssociationSpecImmutable != null) {
         return new OneToManyAssociationSpec(framework.MetamodelManager, oneToManyAssociationSpecImmutable, framework.Session, framework.LifecycleManager, framework.NakedObjectManager, framework.Persistor);
     }
     throw new ReflectionException(Log.LogAndReturn($"Unknown spec type: {specImmutable}"));
 }
        public IAssociationSpec CreateAssociation(IAssociationSpecImmutable specImmutable)
        {
            Assert.AssertNotNull(framework);
            var oneToOneAssociationSpecImmutable = specImmutable as IOneToOneAssociationSpecImmutable;

            if (oneToOneAssociationSpecImmutable != null)
            {
                return(new OneToOneAssociationSpec(framework.MetamodelManager, oneToOneAssociationSpecImmutable, framework.Session, framework.LifecycleManager, framework.NakedObjectManager, framework.Persistor, framework.TransactionManager));
            }
            var oneToManyAssociationSpecImmutable = specImmutable as IOneToManyAssociationSpecImmutable;

            if (oneToManyAssociationSpecImmutable != null)
            {
                return(new OneToManyAssociationSpec(framework.MetamodelManager, oneToManyAssociationSpecImmutable, framework.Session, framework.LifecycleManager, framework.NakedObjectManager, framework.Persistor));
            }
            throw new ReflectionException("Unknown spec type: " + specImmutable);
        }
        public static string ToOrderString(this IAssociationSpecImmutable spec)
        {
            if (spec == null)
            {
                return("");
            }

            var facet  = spec.GetFacet <INamedFacet>();
            var suffix = "";

            if (facet != null)
            {
                suffix = facet.NaturalName;
            }


            return($"{spec.ToIdString()}/{suffix}");
        }
 public IAssociationSpec CreateAssociationSpec(IAssociationSpecImmutable specImmutable)
 {
     Assert.AssertNotNull(framework);
     return(CreateAssociation(specImmutable));
 }
Beispiel #9
0
 public IAssociationSpec CreateAssociationSpec(IAssociationSpecImmutable specImmutable) {
     Assert.AssertNotNull(framework);
     return CreateAssociation(specImmutable);
 }
Beispiel #10
0
 public static void Compare(IAssociationSpecImmutable assoc1, IAssociationSpecImmutable assoc2, string specName)
 {
     Compare(assoc1.OwnerSpec, assoc2.OwnerSpec);
     Compare(assoc1 as IMemberSpecImmutable, assoc2, specName);
 }
Beispiel #11
0
 protected AssociationSpecAbstract(IAssociationSpecImmutable association, INakedObjectsFramework framework)
     : base(association.Identifier.MemberName, association, framework)
 {
     Manager    = framework.NakedObjectManager ?? throw new InitialisationException($"{nameof(framework.NakedObjectManager)} is null");
     ReturnSpec = MetamodelManager.GetSpecification(association.ReturnSpec);
 }
Beispiel #12
0
 protected AssociationSpecAbstract(IMetamodelManager metamodel, IAssociationSpecImmutable association, ISession session, ILifecycleManager lifecycleManager, INakedObjectManager manager, IObjectPersistor persistor)
     : base(association.Identifier.MemberName, association, session, lifecycleManager, metamodel, persistor)
 {
     Manager    = manager ?? throw new InitialisationException($"{nameof(manager)} is null");
     ReturnSpec = MetamodelManager.GetSpecification(association.ReturnSpec);
 }
 public static string ToIdString(this IAssociationSpecImmutable spec)
 {
     return(spec.Identifier.ToIdString() + spec.ReturnSpec.Identifier.ToIdString());
 }