protected override void Apply(IConventionFinder conventionFinder)
 {
     conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>();
     conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>();
     conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseString.Convention>();
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X"));
 }
 public void Apply(string sessionAlias, IConventionFinder conventionFinder)
 {
     foreach (IConventionApplier item in items)
     {
         item.Apply(sessionAlias, conventionFinder);
     }
 }
 public void Apply(string sessionAlias, IConventionFinder conventionFinder)
 {
     foreach (IConventionApplier item in items)
     {
         item.Apply(sessionAlias, conventionFinder);
     }
 }
 protected override void Apply(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>();
     conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>();
     conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseString.Convention>();
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X"));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Map the convention.
 /// </summary>
 /// <param name="finder">Convention finder.</param>
 public virtual void Build(IConventionFinder finder)
 {
     finder.Add <PrimaryKeyConvention>();
     finder.Add <PrimaryKeyGuidConvention>();
     finder.Add(DefaultCascade.None());
     finder.Add(ForeignKey.EndsWith("Id"));
 }
Ejemplo n.º 6
0
 private static void ConfigureConventions(IConventionFinder conventions)
 {
     conventions.Add(DefaultCascade.All());
     conventions.Add(DefaultLazy.Always());
     conventions.Add(ConventionBuilder.Id.Always(convention => convention.GeneratedBy.GuidComb()));
     conventions.Add(ConventionBuilder.HasMany.Always(convention => convention.Inverse()));
     conventions.Add(ConventionBuilder.HasMany.Always(convention => convention.Cascade.AllDeleteOrphan()));
 }
        public PersistenceModel(IConventionFinder conventionFinder)
        {
            mappings = new List<IMappingProvider>();
            visitors = new List<IMappingModelVisitor>();
            ConventionFinder = conventionFinder;

            AddDiscoveryConventions();
        }
Ejemplo n.º 8
0
        public void CreatePersistenceModel()
        {
            conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
            model = new PersistenceModel(conventionFinder);

            cfg = Fluently.Configure()
                .Database(SQLiteConfiguration.Standard.InMemory)
                .BuildConfiguration();
        }
Ejemplo n.º 9
0
        public PersistenceModel(IConventionFinder conventionFinder)
        {
            Conventions = conventionFinder;

            visitors.Add(new SeparateSubclassVisitor(subclassProviders));
            visitors.Add(new BiDirectionalManyToManyPairingVisitor());
            visitors.Add(new ManyToManyTableNameVisitor());
            visitors.Add(new ConventionVisitor(Conventions));
        }
Ejemplo n.º 10
0
 protected override void Apply(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>();
     conventionFinder.Add <Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>();
     //conventionFinder.Add<NHibernate.Extension.Convention.UpperCaseString.Convention>();
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X"));
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.Eumeration.Convention());
     conventionFinder.Add(DynamicUpdate.AlwaysTrue());
 }
 protected override void Apply(IConventionFinder conventionFinder)
 {
     conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseTableName.Convention>();
     conventionFinder.Add<Dao.NHibernate.Extension.Convention.UpperCaseColumnName.Convention>();
     //conventionFinder.Add<NHibernate.Extension.Convention.UpperCaseString.Convention>();
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("X"));
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.Eumeration.Convention());
     conventionFinder.Add(DynamicUpdate.AlwaysTrue());
 }
        public void Apply(string sessionAlias, IConventionFinder conventionFinder)
        {
            if (sessionAlias != this.sessionAlias)
            {
                return;
            }

            Apply(conventionFinder);
        }
        public void CreatePersistenceModel()
        {
            conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
            model = new PersistenceModel(conventionFinder);

            TempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            RemoveArtifacts();
            Directory.CreateDirectory(TempDir);
        }
Ejemplo n.º 14
0
 public ConventionVisitor(IConventionFinder finder)
 {
     collections = new Dictionary <Collection, Action <MappingModel.Collections.CollectionMapping> >
     {
         { Collection.Array, ProcessArray },
         { Collection.Bag, ProcessBag },
         { Collection.Map, ProcessMap },
         { Collection.List, ProcessList },
         { Collection.Set, ProcessSet },
     };
     this.finder = finder;
 }
 public virtual IEnumerable<IAutomappingStep> GetMappingSteps(AutoMapper mapper, IConventionFinder conventionFinder)
 {
     return new IAutomappingStep[]
     {
         new IdentityStep(this),
         new VersionStep(this),
         new ComponentStep(this, mapper),
         new PropertyStep(conventionFinder, this),
         new HasManyToManyStep(this),
         new ReferenceStep(this),
         new HasManyStep(this)
     };
 }
Ejemplo n.º 16
0
 /// <summary>
 /// The add conventions.
 /// </summary>
 /// <param name="conventions">
 /// The conventions.
 /// </param>
 protected virtual void AddConventions(IConventionFinder conventions)
 {
     // uncomment lines if needed
     conventions.Add(new ForeignKeyConstraintHasManyNameConvention());
     conventions.Add(new ForeignKeyConstraintReferenceNameConvention());
     conventions.Add(new ForeignKeyNameConvention());
     conventions.Add(new ManyToManyNameConvention());
     conventions.Add(new ReferenceNameConvention());
     conventions.Add(new ForeignKeyConstraintHasManyToManyNameConvention());
     conventions.Add(new TableNameConvention());
     conventions.Add(new PrimaryKeyNameConvention());
     conventions.Add(new PropertyNameConvention());
     conventions.Add(new EnumConvention());
 }
Ejemplo n.º 17
0
        public PersistenceModel(IConventionFinder conventionFinder)
        {
            BiDirectionalManyToManyPairer = (c, o, w) => {};
            Conventions = conventionFinder;

            visitors.Add(new SeparateSubclassVisitor(subclassProviders));
            visitors.Add(new ComponentReferenceResolutionVisitor(componentResolvers, componentProviders));
            visitors.Add(new RelationshipPairingVisitor(BiDirectionalManyToManyPairer));
            visitors.Add(new ManyToManyTableNameVisitor());
            visitors.Add(new ConventionVisitor(Conventions));
            visitors.Add(new ComponentColumnPrefixVisitor());
            visitors.Add(new RelationshipKeyPairingVisitor());
            visitors.Add((validationVisitor = new ValidationVisitor()));
        }
Ejemplo n.º 18
0
        public AutoMapper(AutoMappingExpressions expressions, IConventionFinder conventionFinder, IEnumerable <InlineOverride> inlineOverrides)
        {
            this.expressions     = expressions;
            this.inlineOverrides = inlineOverrides;

            mappingRules = new List <IAutoMapper>
            {
                new AutoMapIdentity(expressions),
                new AutoMapVersion(),
                new AutoMapComponent(expressions, this),
                new AutoMapProperty(conventionFinder, expressions),
                new AutoMapManyToMany(expressions),
                new AutoMapManyToOne(),
                new AutoMapOneToMany(expressions),
            };
        }
Ejemplo n.º 19
0
        public AutoMapper(AutoMappingExpressions expressions, IConventionFinder conventionFinder, IEnumerable<InlineOverride> inlineOverrides)
        {
            this.expressions = expressions;
            this.inlineOverrides = inlineOverrides;

            mappingRules = new List<IAutoMapper>
            {
                new AutoMapIdentity(expressions),
                new AutoMapVersion(),
                new AutoMapComponent(expressions, this),
                new AutoMapProperty(conventionFinder, expressions),
                new AutoMapManyToMany(expressions),
                new AutoMapManyToOne(),
                new AutoMapOneToMany(expressions),
            };
        }
Ejemplo n.º 20
0
 public virtual void AddHasManyConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <HasManyConvention>();
 }
Ejemplo n.º 21
0
 public ConventionWithIConventionFinderConstructor(IConventionFinder conventionFinder)
 { }
 public void CreateConvention()
 {
     conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
     convention = new JoinMappingPartDiscoveryConvention(conventionFinder);
 }
Ejemplo n.º 23
0
 public AutoMapProperty(IConventionFinder conventionFinder, AutoMappingExpressions expressions)
 {
     this.conventionFinder = conventionFinder;
     this.expressions = expressions;
 }
 public void Merge(IConventionFinder conventionFinder)
 {
     conventions.Merge(conventionFinder.Conventions);
 }
 public void CreatePersistenceModel()
 {
     conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
     model = new PersistenceModel(conventionFinder);
 }
 public PropertyDiscoveryConvention(IConventionFinder conventionFinder)
 {
     this.conventionFinder = conventionFinder;
 }
 public ReferenceDiscoveryConvention(IConventionFinder conventionFinder)
 {
     this.conventionFinder = conventionFinder;
 }
 public VersionDiscoveryConvention(IConventionFinder conventionFinder)
 {
     this.conventionFinder = conventionFinder;
 }
        public PersistenceModel(IConventionFinder conventionFinder)
        {
            Conventions = conventionFinder;

            visitors.Add(new SeparateSubclassVisitor(subclassProviders));
            visitors.Add(new BiDirectionalManyToManyPairingVisitor());
            visitors.Add(new ManyToManyTableNameVisitor());
            visitors.Add(new ConventionVisitor(Conventions));
        }
 public void CreateConvention()
 {
     conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
     convention = new HasManyToManyDiscoveryConvention(conventionFinder);
 }
 public void Apply(string sessionAlias, IConventionFinder conventionFinder)
 {
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("DTC"));
 }
Ejemplo n.º 32
0
 public ConventionWithIConventionFinderConstructor(IConventionFinder conventionFinder)
 {
 }
Ejemplo n.º 33
0
 public virtual void AddTableNameConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <TableNameConvention>();
 }
 public HasManyToManyDiscoveryConvention(IConventionFinder conventionFinder)
 {
     this.conventionFinder = conventionFinder;
 }
Ejemplo n.º 35
0
 internal PrivateAutoMapper(AutoMappingExpressions expressions, IConventionFinder conventionFinder, IEnumerable<InlineOverride> inlineOverrides)
     : base(expressions, conventionFinder, inlineOverrides)
 {
     localExpressions = expressions;
 }
Ejemplo n.º 36
0
 public SetupConventionFinder(TReturn container, IConventionFinder conventionFinder)
 {
     parent = container;
     this.conventionFinder = conventionFinder;
 }
Ejemplo n.º 37
0
 public PropertyStep(IConventionFinder conventionFinder, IAutomappingConfiguration cfg)
 {
     this.conventionFinder = conventionFinder;
     this.cfg = cfg;
 }
 public override IEnumerable <IAutomappingStep> GetMappingSteps(AutoMapper mapper, IConventionFinder conventionFinder)
 {
     return(base.GetMappingSteps(mapper, conventionFinder).Select(x => x.GetType() == typeof(HasManyStep) ? new MyMa(x) : x));
 }
Ejemplo n.º 39
0
 public ConventionVisitor(IConventionFinder finder)
 {
     this.finder = finder;
 }
 void IConventionFinder.Merge(IConventionFinder other)
 {
     conventionFinder.Merge(other);
 }
Ejemplo n.º 41
0
 public DummyClassAssemblyConvention(IConventionFinder finder)
 {
 }
 public HasOneDiscoveryConvention(IConventionFinder conventionFinder)
 {
     this.conventionFinder = conventionFinder;
 }
 public void CreateConvention()
 {
     conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
     convention = new ReferenceDiscoveryConvention(conventionFinder);
 }
 public SubclassDiscoveryConvention(IConventionFinder conventionFinder)
 {
     this.conventionFinder = conventionFinder;
 }
Ejemplo n.º 45
0
 internal ConventionFinderAdapter(IConventionFinder finder)
 {
     Finder = finder;
 }
Ejemplo n.º 46
0
 public virtual void AddPrimaryKeyConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <PrimaryKeyConvention>();
 }
Ejemplo n.º 47
0
 internal static IList <IConvention> ToList(this IConventionFinder finder)
 {
     return(new ConventionFinderAdapter(finder));
 }
Ejemplo n.º 48
0
 public virtual void AddManyToManyConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <ManyToManyConvention>();
 }
 public void CreateConvention()
 {
     conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
     convention = new JoinedSubclassDiscoveryConvention(conventionFinder);
 }
Ejemplo n.º 50
0
 public virtual void AddReferenceConvention(IConventionFinder conventionFinder)
 {
     conventionFinder.Add <ReferenceConvention>();
 }
        /*
        private static Action<AutoMappingExpressions> GetSetup()
        {
            return c =>
            {
                c.FindIdentity = member => member.Name == "Id";
                c.IsConcreteBaseType = IsBaseTypeConvention;
                c.AbstractClassIsLayerSupertype = type => !IsDomainEntity(type);
                c.IsComponentType = IsComponentTypeConvention;
            };
        }

        private static bool IsDomainEntity(Type type)
        {
            return GetAutoMappingFilter(type)
                   && type.Assembly == typeof(Player).Assembly
                   && type != typeof(SummarisableEntity);
        }*/
        /// <summary>
        /// This project's conventions (which may be changed) are as follows:
        /// * Table names are plural
        /// * The Id of an object is "Id"
        /// * Foreign keys are "ObjectNameFk"
        /// * One-to-Many relationships cascade "All"
        /// 
        /// Feel free to change this to your project's needs!
        /// </summary>
        private static void GetConventions(IConventionFinder finder)
        {
            finder.Add(Table.Is(map => Inflector.Net.Inflector.Pluralize(map.EntityType.Name)));

            //c.FindIdentity = type => type.Name == "Id";
            finder.Add(PrimaryKey.Name.Is(map => "Id"));

            //c.GetForeignKeyName = type => type.Name + "Fk";
            finder.Add(ForeignKey.EndsWith("Fk"));

            //c.GetForeignKeyNameOfParent = type => type.Name + "Fk";

            //c.OneToManyConvention = o => o.Cascade.All();
            finder.Add(ConventionBuilder.Reference.Always(r => r.Cascade.SaveUpdate()));
            finder.Add(ConventionBuilder.HasMany.Always(r => r.Cascade.All()));
            finder.Add(ConventionBuilder.HasManyToMany.Always(r => r.Cascade.All()));

            //finder.Add(new RequiredConvention());
            //finder.Add(new SetConvention());
            //finder.Add(new BlobDocumentConvention());
            //finder.Add(new StringLengthConvention());
            //finder.Add(new ValueTypePropertyConvention());
        }
Ejemplo n.º 52
0
 public AutoMapper(IAutomappingConfiguration cfg, IConventionFinder conventionFinder, IEnumerable <InlineOverride> inlineOverrides)
 {
     this.cfg = cfg;
     this.conventionFinder = conventionFinder;
     this.inlineOverrides  = inlineOverrides;
 }
Ejemplo n.º 53
0
 public AutoMapper(IAutomappingConfiguration cfg, IConventionFinder conventionFinder, IEnumerable<InlineOverride> inlineOverrides)
 {
     this.cfg = cfg;
     this.conventionFinder = conventionFinder;
     this.inlineOverrides = inlineOverrides;
 }
Ejemplo n.º 54
0
 public virtual IEnumerable <IAutomappingStep> GetMappingSteps(AutoMapper mapper, IConventionFinder conventionFinder)
 {
     return(new IAutomappingStep[]
     {
         new IdentityStep(this),
         new VersionStep(this),
         new ComponentStep(this),
         new PropertyStep(conventionFinder, this),
         new HasManyToManyStep(this),
         new ReferenceStep(this),
         new HasManyStep(this)
     });
 }
 public void CreateConvention()
 {
     conventionFinder = MockRepository.GenerateMock<IConventionFinder>();
     convention = new DynamicComponentDiscoveryConvention(conventionFinder);
 }
 public void Apply(string sessionAlias, IConventionFinder conventionFinder)
 {
     conventionFinder.Add(new Dao.NHibernate.Extension.Convention.TablePrefix.Convention("DTC"));
 }
 public DynamicComponentDiscoveryConvention(IConventionFinder conventionFinder)
 {
     this.conventionFinder = conventionFinder;
 }
Ejemplo n.º 58
0
 public PropertyStep(IConventionFinder conventionFinder, IAutomappingConfiguration cfg)
 {
     this.conventionFinder = conventionFinder;
     this.cfg = cfg;
 }
Ejemplo n.º 59
0
 public AutoMapProperty(IConventionFinder conventionFinder, AutoMappingExpressions expressions)
 {
     this.conventionFinder = conventionFinder;
     this.expressions      = expressions;
 }