public async Task CastWithPrecisionScaleAsync()
        {
            if (TestDialect.HasBrokenDecimalType)
            {
                Assert.Ignore("Dialect does not correctly handle decimal.");
            }

            using (var s = OpenSession())
            {
                var value = await(s
                                  .CreateCriteria <Student>()
                                  .SetProjection(
                                      Projections.Cast(
                                          TypeFactory.Basic("decimal(18,9)"),
                                          Projections.Constant(123456789.123456789m, TypeFactory.Basic("decimal(18,9)"))))
                                  .UniqueResultAsync <decimal>());
                Assert.That(value, Is.EqualTo(123456789.123456789m), "Same type cast");

                value = await(s
                              .CreateCriteria <Student>()
                              .SetProjection(
                                  Projections.Cast(
                                      TypeFactory.Basic("decimal(18,7)"),
                                      Projections.Constant(123456789.987654321m, TypeFactory.Basic("decimal(18,9)"))))
                              .UniqueResultAsync <decimal>());
                Assert.That(value, Is.EqualTo(123456789.9876543m), "Reduced scale cast");
            }
        }
Example #2
0
        public IFieldReader GetReader(System.Type type)
        {
            IConverter standardConverter = this.GetStandardConverter(type);

            if (standardConverter != null)
            {
                return((IFieldReader) new CustomReader(standardConverter));
            }
            if (type.IsEnum && Enum.GetUnderlyingType(type) == typeof(uint))
            {
                return((IFieldReader) new CustomReader((IConverter) new ToUIntEnumConverter(type)));
            }
            IType type1 = TypeFactory.Basic(type.FullName);

            if (type.IsEnum)
            {
                type1 = NHibernateUtil.Enum(type);
            }
            else if (NHibernateConverterProvider.IsNullableEnum(type))
            {
                type1 = NHibernateUtil.Enum(type.GetGenericArguments()[0]);
            }
            if (type1 == null)
            {
                return((IFieldReader)null);
            }
            if (!(type1 is NullableType))
            {
                throw new ArgumentException("Invalid Type must be nullable - Found: " + (object)type1);
            }
            return((IFieldReader) new NullableTypeReader((NullableType)type1));
        }
Example #3
0
        public SaleMap()
        {
            Mutable(false);
            Table("SALESTABLE");
            Id(x => x.Id, map =>
            {
                map.Column("SALESID");
                map.Generator(Generators.Assigned);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(string).FullName));
            });

            ManyToOne(x => x.Production, map =>
            {
                map.Column("SALESID");
                map.NotNullable(false);
                map.Lazy(LazyRelation.Proxy);
                map.Cascade(Cascade.None);
                map.Class(typeof(Production));
            });
            Property(x => x.Name, map =>
            {
                map.Column("SALESNAME");
                map.Length(140);
                map.NotNullable(true);
                map.Access(Accessor.ReadOnly);
            });
            Property(x => x.CustAccount, map =>
            {
                map.Column("CUSTACCOUNT");
                map.Length(20);
                map.NotNullable(true);
                map.Access(Accessor.ReadOnly);
            });
        }
Example #4
0
        public void HoldQualifiedTypes()
        {
            var decimalType  = TypeFactory.Basic("Decimal(10,5)");
            var doubleType   = TypeFactory.Basic("Double(10,5)");
            var singleType   = TypeFactory.Basic("Single(10,5)");
            var currencyType = TypeFactory.Basic("Currency(10,5)");

            Assert.That(decimalType, Is.SameAs(TypeFactory.Basic("Decimal(10,5)")));
            Assert.That(decimalType, Is.Not.SameAs(doubleType));
            Assert.That(decimalType, Is.Not.SameAs(singleType));
            Assert.That(decimalType, Is.Not.SameAs(currencyType));
            Assert.That(decimalType, Is.Not.SameAs(TypeFactory.Basic("Decimal(11,5)")));

            Assert.That(doubleType, Is.SameAs(TypeFactory.Basic("Double(10,5)")));
            Assert.That(doubleType, Is.Not.SameAs(TypeFactory.Basic("Double(11,5)")));
            Assert.That(doubleType, Is.Not.SameAs(singleType));
            Assert.That(doubleType, Is.Not.SameAs(currencyType));

            Assert.That(singleType, Is.Not.SameAs(currencyType));

            Assert.That(currencyType, Is.SameAs(TypeFactory.Basic("Currency(10,5)")));
            Assert.That(currencyType, Is.Not.SameAs(TypeFactory.Basic("Currency(11,5)")));

            Assert.That(singleType, Is.SameAs(TypeFactory.Basic("Single(10,5)")));
            Assert.That(singleType, Is.Not.SameAs(TypeFactory.Basic("Single(11,5)")));
        }
Example #5
0
        public PriceItemMap()
        {
            Mutable(false);
            Table("INVENTTABLEMODULE");
            Id(x => x.Id, map =>
            {
                map.Column("RECID");
                map.Generator(Generators.Assigned);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(long).FullName));
            });
            ManyToOne(x => x.Item, map =>
            {
                map.Cascade(Cascade.None);
                map.Class(typeof(Item));
                map.Column("ITEMID");
                map.Lazy(LazyRelation.Proxy);
                map.NotNullable(false);
            });
            Property(x => x.TypePrice, map =>
            {
                map.Column("MODULETYPE");
                map.NotNullable(false);
                map.Type(NHibernate.NHibernateUtil.GuessType(typeof(TypePrice)));
            });

            Property(x => x.Price, map => { map.Column("PRICE"); map.NotNullable(false); });
            Property(x => x.Unit, map => { map.Column("PRICEUNIT"); map.NotNullable(false); });
        }
Example #6
0
 protected EntityMapper()
 {
     Id(x => x.Id, map =>
     {
         map.Generator(Generators.Identity);
         map.Type((IIdentifierType)TypeFactory.Basic(typeof(Int32).FullName));
     });
 }
Example #7
0
 public void ObsoleteMessage()
 {
     using (var spy = new LogSpy(typeof(TypeFactory)))
     {
         TypeFactory.Basic(NHibernateUtil.DateTime2.Name);
         Assert.That(
             spy.GetWholeLog(),
             Does.Contain($"{NHibernateUtil.DateTime2.Name} is obsolete. Use DateTimeType instead").IgnoreCase);
     }
 }
Example #8
0
        public StatusTaskMap()
        {
            Table("StatusTask");
            Id(x => x.Id, map =>
            {
                map.Column("Id");
                map.Generator(Generators.Identity);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(int).FullName));
                map.UnsavedValue(0);
            });
            Property(x => x.StartRun, map =>
            {
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(DateTime).FullName));
            });
            Property(x => x.Error, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.TotalRows, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(int?).FullName));
            });
            Property(x => x.ErrorRows, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(int?).FullName));
            });

            Property(x => x.EndRun, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(DateTime?).FullName));
            });
            Property(x => x.TaskExecType, map =>
            {
                map.NotNullable(true);
                map.Type(NHibernateUtil.
                         GuessType(
                             typeof(
                                 TaskExecType
                                 )));
            });
            ManyToOne(x => x.Sheduler, map =>
            {
                map.Cascade(Cascade.None);
                map.Class(typeof(Sheduler));
                map.Column("IdShedule");
                map.Lazy(LazyRelation.Proxy);
                map.NotNullable(false);
            });
        }
Example #9
0
 public UnitMap()
 {
     Mutable(false);
     Table("UNIT");
     Id(x => x.Id, map =>
     {
         map.Column("UNITID");
         map.Generator(Generators.Assigned);
         map.Length(10);
         map.Type((IIdentifierType)TypeFactory.Basic(typeof(string).FullName));
     });
 }
        public void Execute_CommandWithParameters_QueryMethodCalled()
        {
            var sqlQuery = new Mock <ISQLQuery>();
            var session  = new Mock <ISession>();

            session.Setup(x => x.CreateSQLQuery(It.IsAny <string>())).Returns(sqlQuery.Object);
            var commandExecutor = new CommandExecutor <TestCommand>(session.Object);

            commandExecutor.Execute(new TestCommand());

            sqlQuery.Verify(x => x.SetParameter("param", 12L, TypeFactory.Basic(typeof(long).FullName)));
            sqlQuery.Verify(x => x.ExecuteUpdate(), Times.Once);
        }
Example #11
0
        public void MappedAsShouldUseExplicitSize()
        {
            Driver.ClearCommands();

            using (var session = OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    session.Query <Entity>().Where(x => x.Name == "Bob".MappedAs(TypeFactory.Basic("AnsiString(200)"))).ToList();

                    Assert.That(Driver.LastCommandParameters.First().Size, Is.EqualTo(200));
                    Assert.That(Driver.LastCommandParameters.First().SqlDbType, Is.EqualTo(SqlDbType.VarChar));
                }
        }
Example #12
0
 public IdsForTrainingMap()
 {
     Table("IdsForTraining");
     Id(x => x.Id, map =>
     {
         map.Column("Id");
         map.Generator(Generators.Assigned);
         map.Type((IIdentifierType)TypeFactory.Basic(typeof(string).FullName));
     });
     Property(x => x.Value, map =>
     {
         map.NotNullable(false);
         map.Type(TypeFactory.Basic(typeof(string).FullName));
     });
 }
Example #13
0
        protected static bool NeedQualifiedClassName(string className)
        {
            if (string.IsNullOrEmpty(className))
            {
                return(false);
            }
            if (className.IndexOf('.') > 0)
            {
                return(false);
            }
            if (TypeFactory.Basic(className) != null)
            {
                return(false);
            }

            return(true);
        }
Example #14
0
        private ISQLQuery CreateSqlQuery(T command)
        {
            var nhQuery = _session.CreateSQLQuery(command.Sql);

            if (command.Parameters != null && command.Parameters.Any())
            {
                foreach (var parameter in command.Parameters)
                {
                    var val = parameter.Value;
                    if (val != null)
                    {
                        nhQuery.SetParameter(parameter.Key, val.BaseValue, TypeFactory.Basic(val.Type.FullName));
                    }
                }
            }

            return(nhQuery);
        }
Example #15
0
 public SizeTypeMap()
 {
     Mutable(false);
     Table("SF_SIZETYPES");
     Id(x => x.Id, map =>
     {
         map.Column("SIZETYPEID");
         map.Generator(Generators.Assigned);
         map.Length(20);
         map.Type((IIdentifierType)TypeFactory.Basic(typeof(string).FullName));
     });
     Property(x => x.StandartPackQty, map =>
     {
         map.Column("STANDARTPACKQTY");
         map.NotNullable(true);
         map.Type(TypeFactory.Basic(typeof(double).FullName));
     });
 }
Example #16
0
        /// <inheritdoc />
        public void Execute(T command)
        {
            using (new LogAutoStopWatch($"Starting command '{command.Sql}'...", LogLevel.Debug))
            {
                var nhQuery = _session.CreateSQLQuery(command.Sql);

                if (command.Parameters != null && command.Parameters.Any())
                {
                    foreach (var parameter in command.Parameters)
                    {
                        var val = parameter.Value;
                        if (val != null)
                        {
                            nhQuery.SetParameter(parameter.Key, val.BaseValue, TypeFactory.Basic(val.Type.FullName));
                        }
                    }
                }

                nhQuery.ExecuteUpdate();
            }
        }
Example #17
0
 public GroupMap()
 {
     Mutable(false);
     Table("INVENTITEMGROUP");
     Id(x => x.Id, map =>
     {
         map.Column("ITEMGROUPID");
         map.Generator(Generators.Assigned);
         map.Type((IIdentifierType)TypeFactory.Basic(typeof(string).FullName));
     });
     Property(x => x.StandartPackQty, map =>
     {
         map.Column("SF_STANDARTPACKQTY");
         map.NotNullable(true);
     });
     Property(x => x.Name, map =>
     {
         map.Column("NAME");
         map.Length(140);
         map.NotNullable(true);
     });
     Property(x => x.RecId, map =>
     {
         map.Column("RECID");
         map.NotNullable(true);
     });
     Set(p => p.Items, cm =>
     {
         cm.Access(Accessor.Field);
         cm.Cascade(Cascade.None);
         cm.Fetch(CollectionFetchMode.Select);
         cm.Inverse(true);
         cm.Key(km =>
         {
             km.Column("ITEMGROUPID");
             km.NotNullable(false);
         });
         cm.Lazy(CollectionLazy.Lazy);
     }, m => m.OneToMany(om => om.Class(typeof(Item))));
 }
Example #18
0
 public MonthlyFrequencyMap()
 {
     Lazy(false);
     DiscriminatorValue("monthly");
     Join("Frequency", join =>
     {
         join.Table("MonthlyFrequency");
         join.Key(x =>
         {
             x.Column("Frequency");
             x.NotNullable(true);
             x.Unique(true);
             x.ForeignKey("FK_MontlyFrequency_SheduleFrequency");
         });
         join.Property(x => x.DayOffset, map =>
         {
             map.Column("DayNumber");
             map.NotNullable(false);
             map.Access(Accessor.Field);
             map.Type(
                 TypeFactory.Basic(
                     typeof(int?).FullName));
         });
         join.Property(x => x.WeekNumber, map =>
         {
             map.NotNullable(false);
             map.Type(
                 NHibernateUtil.GuessType(
                     typeof(RhythmByWeek?)));
         });
         join.Property(x => x.Week, map =>
         {
             map.NotNullable(false);
             map.Type(
                 NHibernateUtil.GuessType(
                     typeof(DayOfWeek?)));
         });
     });
 }
Example #19
0
        public BarcodeItemMap()
        {
            Mutable(false);
            Table("INVENTITEMBARCODE");
            Id(x => x.Barcode, map =>
            {
                map.Column("ITEMBARCODE");
                map.Length(80);
                map.Generator(Generators.Assigned);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(string).FullName));
            });

            ManyToOne(x => x.Item, map =>
            {
                map.Column("ITEMID");
                map.NotNullable(false);
                map.Lazy(LazyRelation.Proxy);
                map.Cascade(Cascade.None);
                map.Class(typeof(Item));
            });

            Property(x => x.Type, map => { map.Column("BARCODESETUPID"); map.Length(10); map.NotNullable(false); });
            Property(x => x.Quantity, map => { map.Column("QTY");
                                               map.NotNullable(false);
                                               map.Type(TypeFactory.Basic(typeof(decimal).FullName)); });
            //        Property(x => x.INVENTDIMID, map => { map.Column("INVENTDIMID"); map.Length(20); map.NotNullable(false); });
            //        Property(x => x.BARCODESETUPID, map => { map.Column("BARCODESETUPID"); map.Length(10); map.NotNullable(false); });
            //        Property(x => x.USEFORPRINTING, map => { map.Column("USEFORPRINTING"); map.NotNullable(false); });
            //        Property(x => x.USEFORINPUT, map => { map.Column("USEFORINPUT"); map.NotNullable(false); });
            //        Property(x => x.DESCRIPTION, map => { map.Column("DESCRIPTION"); map.Length(60); map.NotNullable(false); });

            //        Property(x => x.MODIFIEDDATE, map => { map.Column("MODIFIEDDATE"); map.NotNullable(false); });
            //        Property(x => x.MODIFIEDTIME, map => { map.Column("MODIFIEDTIME"); map.NotNullable(false); });
            //        Property(x => x.MODIFIEDBY, map => { map.Column("MODIFIEDBY"); map.Length(5); map.NotNullable(false); });
            //        Property(x => x.RECVERSION, map => { map.Column("RECVERSION"); map.NotNullable(false); });
            //        Property(x => x.RECID, map => { map.Column("RECID"); map.NotNullable(false); });        }
        }
Example #20
0
 public DimensionsMap()
 {
     Mutable(false);
     Table("INVENTDIM");
     Where("DATAAREAID='sof'");
     Id(x => x.Id, map =>
                       {
                           map.Column("INVENTDIMID");
                           map.Generator(Generators.Assigned);
                           map.Length(20);
                           map.Type((IIdentifierType) TypeFactory.Basic(typeof (string).FullName));
                       });
     Property(x=>x.DataAreaId,map=>
                                  {
                                      map.Column("DATAAREAID");
                                      map.Length(3);
                                      map.NotNullable(true);
                                  });
     Property(x=>x.SF_ColorId,map=>
                                  {
                                      map.Column("SF_COLORID");
                                      map.Length(20);
                                      map.NotNullable(true);
                                  });
     Property(x => x.SF_HeightId, map =>
     {
         map.Column("SF_HEIGHTID");
         map.Length(10);
         map.NotNullable(true);
     });
     Property(x => x.SF_WidthId, map =>
     {
         map.Column("SF_WIDTHID");
         map.Length(10);
         map.NotNullable(true);
     });
 }
        public IFieldReader GetReader(Type type)
        {
            var stdConv = GetStandardConverter(type);

            if (stdConv != null)
            {
                return(new CustomReader(stdConv));
            }

            if (type.IsEnum && (Enum.GetUnderlyingType(type)) == typeof(uint))
            {
                return(new CustomReader(new ToUIntEnumConverter(type)));
            }

            var hibernateType = TypeFactory.Basic(type.FullName);

            if (type.IsEnum)
            {
                hibernateType = NHibernateUtil.Enum(type);
            }
            else if (IsNullableEnum(type))
            {
                hibernateType = NHibernateUtil.Enum(type.GetGenericArguments()[0]);
            }

            if (hibernateType != null)
            {
                if (!(hibernateType is NullableType))
                {
                    throw new ArgumentException("Invalid Type must be nullable - Found: " + hibernateType);
                }
                return(new NullableTypeReader((NullableType)hibernateType));
            }

            return(null);
        }
Example #22
0
 public UnitConvertMap()
 {
     Mutable(false);
     Table("UNITCONVERT");
     Id(x => x.Id, map =>
     {
         map.Column("RECID");
         map.Generator(Generators.Assigned);
         map.Type((IIdentifierType)TypeFactory.Basic(typeof(long).FullName));
     });
     Property(x=>x.FromUnit, map=>
                                 {
                                     map.Column("FROMUNIT");
                                     map.NotNullable(true);
                                     map.Length(10);
                                 });
     Property(x => x.ToUnit, map =>
     {
         map.Column("TOUNIT");
         map.NotNullable(true);
         map.Length(10);
     });
        Property(x => x.Factor, map =>
     {
         map.Column("FACTOR");
         map.NotNullable(true);
     });
        ManyToOne(x => x.Item, map =>
        {
        map.Cascade(Cascade.None);
        map.Class(typeof(Item));
        map.Column("ITEMID");
        map.Lazy(LazyRelation.Proxy);
        map.NotNullable(false);
        });
 }
Example #23
0
 /// <summary>
 /// Gets the Hibernate type of the specified column.
 /// </summary>
 /// <param name="columnPos">The column position.</param>
 /// <returns>The Hibernate type.</returns>
 public IType GetHibernateType(int columnPos)
 {
     return(TypeFactory.Basic(resultSet.GetFieldType(columnPos).Name));
 }
        public void TestLinqQueryOnExpression()
        {
            using (var s = OpenSession())
                using (var t = s.BeginTransaction())
                {
                    var queryResult = s
                                      .Query <TestEntity>()
                                      .Where(
                        // Without MappedAs, the test fails for SQL Server because it would restrict its parameter to the dialect's default scale.
                        e => (e.UsePreviousRate ? e.PreviousRate : e.Rate) == _testRate.MappedAs(TypeFactory.Basic("decimal(18,13)")))
                                      .ToList();

                    Assert.That(queryResult.Count, Is.EqualTo(1));
                    Assert.That(queryResult[0].PreviousRate, Is.EqualTo(_testRate));
                    t.Commit();
                }
        }
Example #25
0
 public WeeklyFrequencyMap()
 {
     Lazy(false);
     DiscriminatorValue("weekly");
     Join("Frequency", join =>
     {
         join.Table("WeeklyFrequency");
         join.Fetch(FetchKind.Join);
         join.Key(x =>
         {
             x.Column("Frequency");
             x.NotNullable(true);
             x.Unique(true);
             x.ForeignKey("FK_WeeklyFrequency_SheduleFrequency");
         });
         join.Property("IsOccursOnMon", map =>
         {
             map.Column("OnlyMon");
             map.NotNullable(true);
             map.Type(
                 TypeFactory.Basic(
                     typeof(bool).FullName));
         });
         join.Property("IsOccursOnTue", map =>
         {
             map.Column("OnlyTue");
             map.NotNullable(true);
             map.Type(
                 TypeFactory.Basic(
                     typeof(bool).FullName));
         });
         join.Property("IsOccursOnWed", map =>
         {
             map.Column("OnlyWed");
             map.NotNullable(true);
             map.Type(
                 TypeFactory.Basic(
                     typeof(bool).FullName));
         });
         join.Property("IsOccursOnThu", map =>
         {
             map.Column("OnlyThu");
             map.NotNullable(true);
             map.Type(
                 TypeFactory.Basic(
                     typeof(bool).FullName));
         });
         join.Property("IsOccursOnFri", map =>
         {
             map.Column("OnlyFri");
             map.NotNullable(true);
             map.Type(
                 TypeFactory.Basic(
                     typeof(bool).FullName));
         });
         join.Property("IsOccursOnSat", map =>
         {
             map.Column("OnlySat");
             map.NotNullable(true);
             map.Type(
                 TypeFactory.Basic(
                     typeof(bool).FullName));
         });
         join.Property("IsOccursOnSun", map =>
         {
             map.Column("OnlySun");
             map.NotNullable(true);
             map.Type(
                 TypeFactory.Basic(
                     typeof(bool).FullName));
         });
     });
 }
Example #26
0
        public ShedulerMap()
        {
            Table("Sheduler");
            Id(x => x.Id, map =>
            {
                map.Column("ID");
                map.Generator(Generators.Identity);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(int).FullName));
                map.UnsavedValue(0);
            });
            Discriminator(dm =>
            {
                dm.Column("Type");
                dm.Length(50);
                dm.Type(TypeFactory.Basic(typeof(string).FullName));
                dm.NotNullable(true);
                dm.Insert(false);
            });

            Property(x => x.Type, map =>
            {
                map.Access(Accessor.NoSetter);
                map.Column("Type");
                map.Length(50);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
                map.NotNullable(true);
            });
            Property(x => x.Name, map =>
            {
                map.Access(Accessor.Property);
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.Param, map =>
            {
                map.Access(Accessor.Property);
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.TimeGetData, map =>
            {
                map.Access(Accessor.Property);
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(DateTime?).FullName));
            });
            Property(x => x.CreatedOn, map =>
            {
                map.Access(Accessor.NoSetter);
                map.Column(x => x.Default("getdate()"));
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(DateTime).FullName));
                map.Generated(PropertyGeneration.Insert);
                map.Update(false);
            });
            Property(x => x.LastRun, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(DateTime?).FullName));
            });
            Property(x => x.NextRun, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(DateTime?).FullName));
            });
            Property(x => x.Duration, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(decimal?).FullName));
            });
            Property(x => x.Runtime, map =>
            {
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(int?).FullName));
            });
            Property(x => x.Iteration, map =>
            {
                map.Access(Accessor.Field);
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.IsEnabled, map =>
            {
                map.Access(Accessor.Field);
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(bool).FullName));
            });
            Property(x => x.IsKill, map =>
            {
                map.Access(Accessor.Field);
                map.NotNullable(true);
                map.Column(x => x.Default("0"));
                map.Type(TypeFactory.Basic(typeof(bool).FullName));
            });
            ManyToOne(x => x.Frequency, map =>
            {
                map.Class(typeof(SheduleFrequencyProperty));
                map.Cascade(Cascade.DeleteOrphans | Cascade.All);
                map.NotNullable(false);
                map.Lazy(LazyRelation.NoProxy);
                map.ForeignKey("FK_Sheduler_SheduleFrequency");
                map.Access(Accessor.Field);
            });
        }
Example #27
0
        public RouteMap()
        {
            Mutable(false);
            Table("SF_WO2ENT");
            Id(x => x.Id, map =>
            {
                map.Column("RECID");
                map.Generator(Generators.Assigned);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(long).FullName));
            });

            Id(x => x.Id, map =>
            {
                map.Column("RECID");
                map.Generator(Generators.Assigned);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(long).FullName));
            });
            Property(x => x.OperationNumber, map =>
            {
                map.Column("OPRNUM");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.BS, map =>
            {
                map.Column("BS");
                map.NotNullable(true);
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.BomId, map =>
            {
                map.Column("BOMID");
                map.NotNullable(true);
                map.Length(40);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.EM, map =>
            {
                map.Column("EM");
                map.NotNullable(true);
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.FA, map =>
            {
                map.Column("FA");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.HEIGHT, map =>
            {
                map.Column("HEIGHT");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.HS, map =>
            {
                map.Column("HS");
                map.NotNullable(true);
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.LS, map =>
            {
                map.Column("LS");
                map.NotNullable(true);
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.OM, map =>
            {
                map.Column("OM");
                map.NotNullable(true);
                map.Length(1);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.OW, map =>
            {
                map.Column("OW");
                map.NotNullable(true);
                map.Length(1);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.QTY, map =>
            {
                map.Column("QTY");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
            Property(x => x.RA, map =>
            {
                map.Column("RA");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.RouteId, map =>
            {
                map.Column("ROUTEID");
                map.Length(40);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.SM, map =>
            {
                map.Column("SM");
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });

            Property(x => x.SN, map =>
            {
                map.Column("SN");
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.SOR, map =>
            {
                map.Column("SOR");
                map.Length(500);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.ST, map =>
            {
                map.Column("ST");
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.TN, map =>
            {
                map.Column("TN");
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
            Property(x => x.TS, map =>
            {
                map.Column("TS");
                map.Length(20);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.WG, map =>
            {
                map.Column("WG");
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
        }
        public ProductionRouteMap()
        {
            Mutable(false);
            Table("ProdRoute");
            Id(x => x.Id, map =>
            {
                map.Column("RECID");
                map.Generator(Generators.Assigned);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(long).FullName));
            });

            ManyToOne(x => x.Production, map =>
            {
                map.Access(Accessor.Property);
                map.Column("PRODID");
                map.NotNullable(false);
                map.Lazy(LazyRelation.Proxy);
                map.Cascade(Cascade.None);
                map.Class(typeof(Production));
            });

            Property(x => x.OprNum, map =>
            {
                map.Column("OPRNUM");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.OprNumNext, map =>
            {
                map.Column("OPRNUMNEXT");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.Oprid, map =>
            {
                map.Column("OPRID");
                map.Length(10);
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });
            Property(x => x.fromdate, map =>
            {
                map.Column("FROMDATE");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(DateTime).FullName));
            });
            Property(x => x.Todate, map =>
            {
                map.Column("TODATE");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(DateTime).FullName));
            });

            Property(x => x.WrkCtrID, map =>
            {
                map.Column("WRKCTRID");
                map.Length(10);
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(string).FullName));
            });

            Property(x => x.SF_PRIOR, map =>
            {
                map.Column("SF_PRIOR");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Property(x => x.Calcqty, map =>
            {
                map.Column("CALCQTY");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
            Property(x => x.Processperqty, map =>
            {
                map.Column("PROCESSPERQTY");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
            Property(x => x.Setuptime, map =>
            {
                map.Column("SETUPTIME");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
            Property(x => x.Processtime, map =>
            {
                map.Column("PROCESSTIME");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
            Property(x => x.Transptime, map =>
            {
                map.Column("TRANSPTIME");
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(double).FullName));
            });
        }
Example #29
0
        public SheduleFrequencyPropertyMap()
        {
            Table("SheduleFrequency");
            Lazy(false);
            Id(x => x.Id, map =>
            {
                map.Column("Id");
                map.Generator(Generators.Identity);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(int).FullName));

                map.UnsavedValue(0);
            });
            Discriminator(dm =>
            {
                dm.Column("FrequencyType");
                dm.Length(50);
                dm.Type(TypeFactory.Basic(typeof(string).FullName));
                dm.NotNullable(true);
                // dm.Insert(false);
            });
            Property(x => x.DurationFrom, map =>
            {
                map.Access(Accessor.Field);
                map.Column(col =>
                {
                    col.Name("DurationDateStart");
                    col.SqlType("date");
                });
                map.NotNullable(true);
                map.Type(TypeFactory.Basic(typeof(DateTime).FullName));
            });
            Property(x => x.DurationTo, map =>
            {
                map.Access(Accessor.Field);
                map.Column(col =>
                {
                    col.Name("DurationDateStop");
                    col.SqlType("date");
                });
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(DateTime).FullName));
            });
            Property(x => x.Period, map =>
            {
                map.Access(Accessor.Field);
                map.Column("RecursEvery");
                map.NotNullable(false);
                map.Type(TypeFactory.Basic(typeof(int).FullName));
            });
            Component(x => x.DailyFrequency, map =>
            {
                map.Access(Accessor.Field);
                map.Class <TimeSpanFrequency>();
                map.Lazy(false);
                map.Property(p => p.Period, m =>
                {
                    map.Access(Accessor.Field);
                    m.Column(
                        "EveryDailyOccursValue");
                    m.NotNullable(true);
                    m.Type(
                        TypeFactory.Basic(
                            typeof(int).FullName));
                });
                map.Property(p => p.OccursEvery, m =>
                {
                    m.Column(
                        "EveryDailyOccursValueType");
                    m.NotNullable(true);
                    m.Type(
                        NHibernateUtil.
                        GuessType(
                            typeof(
                                RhythmByTime
                                )));
                });
                map.Property(p => p.StartingAt, m =>
                {
                    m.Column(
                        "EveryDailyStartingAt");
                    m.NotNullable(true);
                    m.Type(
                        TypeFactory.Basic(
                            typeof(TimeSpan).
                            FullName));
                });
                map.Property(p => p.EndingAt, m =>
                {
                    m.Column("EveryDailyEndingAt");
                    m.NotNullable(true);
                    m.Type(
                        TypeFactory.Basic(
                            typeof(TimeSpan).
                            FullName));
                });
            });
        }
Example #30
0
        public ItemMap()
        {
            Mutable(false);
            Table("INVENTTABLE");
            Lazy(false);
            Id(x => x.Id, map =>
            {
                map.Column("ITEMID");
                map.Generator(Generators.Assigned);
                map.Type((IIdentifierType)TypeFactory.Basic(typeof(string).FullName));
            });


            Set(p => p.BarcodeItems, cm =>
            {
                cm.Access(Accessor.Field);
                cm.Cascade(Cascade.None);
                cm.Fetch(CollectionFetchMode.Select);
                cm.Inverse(true);
                cm.Key(km =>
                {
                    km.Column("ITEMID");
                    km.NotNullable(false);
                });
                cm.Lazy(CollectionLazy.Lazy);
            }, m => m.OneToMany(om => om.Class(typeof(BarcodeItem))));
            ManyToOne(x => x.Group, map =>
            {
                map.Cascade(Cascade.None);
                map.Class(typeof(Group));
                map.Column("ITEMGROUPID");
                map.Lazy(LazyRelation.Proxy);
                map.NotNullable(false);
                map.NotFound(NotFoundMode.Ignore);
            });

            Set(p => p.UnitConverts, cm =>
            {
                cm.Access(Accessor.Field);
                cm.Cascade(Cascade.None);
                cm.Fetch(CollectionFetchMode.Select);
                cm.Inverse(true);
                cm.Key(km =>
                {
                    km.Column("ITEMID");
                    km.NotNullable(false);
                });
                cm.Lazy(CollectionLazy.Lazy);
            }, m => m.OneToMany(om => om.Class(typeof(UnitConvert))));
            Set(p => p.PriceItems, cm =>
            {
                cm.Access(Accessor.Field);
                cm.Cascade(Cascade.None);
                cm.Fetch(CollectionFetchMode.Select);
                cm.Inverse(true);
                cm.Key(km =>
                {
                    km.Column("ITEMID");
                    km.NotNullable(false);
                });
                cm.Lazy(CollectionLazy.Lazy);
            }, m => m.OneToMany(om => om.Class(typeof(PriceItem))));
            Property(x => x.RecId, map =>
            {
                map.Column("RECID");
                map.NotNullable(true);
            });
            Property(x => x.Name, map =>
            {
                map.Column("ITEMNAME");
                map.Length(140);
                map.NotNullable(false);
            });
            Property(x => x.SF_PBAMODELTYPEID, map =>
            {
                map.Column("SF_PBAMODELTYPEID");
                map.Length(20);
                map.NotNullable(false);
            });
            ManyToOne(x => x.SizeType, map =>
            {
                map.Cascade(Cascade.None);
                map.Class(typeof(SizeType));
                map.Column("SF_SIZETYPEID");
                map.Lazy(LazyRelation.Proxy);
                map.NotNullable(true);
                map.NotFound(NotFoundMode.Ignore);
            });
            ManyToOne(x => x.Container, map =>
            {
                map.Cascade(Cascade.None);
                map.Class(typeof(ItemContainer));
                map.Column("RECID");
                map.Lazy(LazyRelation.Proxy);
                map.NotNullable(false);
            });

            Property(x => x.SF_Height, map =>
            {
                map.Column("SF_HEIGHT");
                map.NotNullable(false);
            });
            Property(x => x.SF_Width, map =>
            {
                map.Column("SF_WIDTH");
                map.NotNullable(false);
            });
            Property(x => x.GrossHeight, map =>
            {
                map.Column("GROSSHEIGHT");
                map.NotNullable(false);
            });
            Property(x => x.GrossDepth, map =>
            {
                map.Column("GROSSDEPTH");
                map.NotNullable(false);
            });
            Property(x => x.GrossWidth, map =>
            {
                map.Column("GROSSWIDTH");
                map.NotNullable(false);
            });
            Property(x => x.SF_ColorOfMaterialId_1, map =>
            {
                map.Column("SF_COLOROFMATERIALID_1");
                map.Length(20);
                map.NotNullable(false);
            });
            ManyToOne(x => x.BomUnit, map =>
            {
                map.Cascade(Cascade.None);
                map.Class(typeof(Unit));
                map.Column("BOMUNITID");
                map.Lazy(LazyRelation.Proxy);
                map.NotNullable(false);
            });
        }