public DemoService(IRepository<DemoEntity> demoRepository, IEventPublisher eventPublisher,IMapping mapping) { _demoRepository = demoRepository; _eventPublisher = eventPublisher; _mapping = mapping; }
public override string SqlCreateString(Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema) { FinalizeAuditTable((IExtendedDialect) dialect); return auditTable.SqlCreateString( dialect, p, defaultCatalog, defaultSchema); }
public SqlLoader( string[ ] aliases, ISqlLoadable[ ] persisters, ISessionFactoryImplementor factory, string sqlQuery, ICollection additionalQuerySpaces ) : base( factory.Dialect ) { this.sqlQuery = sqlQuery; this.aliases = aliases; // Remember the factory for the PopulateSqlString call. this.factory = factory; alias2Persister = new Hashtable(); ArrayList resultTypeList = new ArrayList(); for( int i = 0; i < persisters.Length; i++ ) { ISqlLoadable persister = persisters[ i ]; alias2Persister.Add( aliases[ i ], persister ); // TODO: Does not consider any other tables referenced in the query querySpaces.AddAll( persister.PropertySpaces ); resultTypeList.Add( persister.Type ); } if( additionalQuerySpaces != null ) { querySpaces.AddAll( additionalQuerySpaces ); } resultTypes = ( IType[ ] ) resultTypeList.ToArray( typeof( IType ) ); RenderStatement( persisters ); PostInstantiate(); }
/// <summary>Read binary attribute data from a file</summary> /// <remarks> /// The expected (sparse) line format is: /// ENTITY_ID tab/space/comma ATTRIBUTE_ID /// for the relations that hold. /// </remarks> /// <param name="filename">the name of the file to be read from</param> /// <param name="mapping">the mapping object for the given entity type</param> /// <returns>the attribute data</returns> static public IBooleanMatrix Read(string filename, IMapping mapping) { return Wrap.FormatException<IBooleanMatrix>(filename, delegate() { using ( var reader = new StreamReader(filename) ) return Read(reader, mapping); }); }
public override string SqlCreateString( Dialect.Dialect dialect, IMapping p, string defaultSchema) { return InjectCatalogAndSchema(sqlCreateString, defaultSchema); }
/// <summary> /// Get the aliased columns of the owning entity which are to /// be used in the join /// </summary> public static string[] GetAliasedLHSColumnNames( IAssociationType type, string alias, int property, int begin, IOuterJoinLoadable lhsPersister, IMapping mapping ) { if (type.UseLHSPrimaryKey) { return StringHelper.Qualify(alias, lhsPersister.IdentifierColumnNames); } else { string propertyName = type.LHSPropertyName; if (propertyName == null) { return ArrayHelper.Slice( lhsPersister.ToColumns(alias, property), begin, type.GetColumnSpan(mapping) ); } else { return ((IPropertyMapping) lhsPersister).ToColumns(alias, propertyName); //bad cast } } }
internal void Register(IMapping mapping) { if (!_mappings.ContainsKey(mapping.InterfaceType)) _mappings[mapping.InterfaceType] = new Collection<IMapping>(); _mappings[mapping.InterfaceType].Add(mapping); }
/// <summary>Read in rating data from a TextReader</summary> /// <param name="reader">the <see cref="TextReader"/> to read from</param> /// <param name="user_mapping">mapping object for user IDs</param> /// <param name="item_mapping">mapping object for item IDs</param> /// <param name="ignore_first_line">if true, ignore the first line</param> /// <returns>the rating data</returns> public static IRatings Read(TextReader reader, IMapping user_mapping = null, IMapping item_mapping = null, bool ignore_first_line = false) { if (user_mapping == null) user_mapping = new IdentityMapping(); if (item_mapping == null) item_mapping = new IdentityMapping(); if (ignore_first_line) reader.ReadLine(); var ratings = new Ratings(); string line; while ( (line = reader.ReadLine()) != null ) { if (line.Length == 0) continue; string[] tokens = line.Split(Constants.SPLIT_CHARS); if (tokens.Length < 3) throw new FormatException("Expected at least 3 columns: " + line); int user_id = user_mapping.ToInternalID(tokens[0]); int item_id = item_mapping.ToInternalID(tokens[1]); float rating = float.Parse(tokens[2], CultureInfo.InvariantCulture); ratings.Add(user_id, item_id, rating); } ratings.InitScale(); return ratings; }
/// <summary> /// Creates a specific Persister - could be a built in or custom persister. /// </summary> public static IEntityPersister Create(System.Type persisterClass, PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg) { ConstructorInfo pc; try { pc = persisterClass.GetConstructor(PersisterConstructorArgs); } catch (Exception e) { throw new MappingException("Could not get constructor for " + persisterClass.Name, e); } try { return (IEntityPersister) pc.Invoke(new object[] {model, cache, factory, cfg}); } catch (TargetInvocationException tie) { Exception e = tie.InnerException; if (e is HibernateException) { throw e; } else { throw new MappingException("Could not instantiate persister " + persisterClass.Name, e); } } catch (Exception e) { throw new MappingException("Could not instantiate persister " + persisterClass.Name, e); } }
public override IType ReturnType(IType columnType, IMapping mapping) { if (columnType == null) { throw new ArgumentNullException("columnType"); } SqlType[] sqlTypes; try { sqlTypes = columnType.SqlTypes(mapping); } catch (MappingException me) { throw new QueryException(me); } if (sqlTypes.Length != 1) { throw new QueryException("multi-column type can not be in avg()"); } SqlType sqlType = sqlTypes[0]; if (sqlType.DbType == DbType.Int16 || sqlType.DbType == DbType.Int32 || sqlType.DbType == DbType.Int64) { return NHibernateUtil.Single; } else { return columnType; } }
/// <summary>Read in rating data which will be interpreted as implicit feedback data from a TextReader</summary> /// <param name="reader">the TextReader to be read from</param> /// <param name="rating_threshold">the minimum rating value needed to be accepted as positive feedback</param> /// <param name="user_mapping">user <see cref="IMapping"/> object</param> /// <param name="item_mapping">item <see cref="IMapping"/> object</param> /// <param name="ignore_first_line">if true, ignore the first line</param> /// <returns>a <see cref="IPosOnlyFeedback"/> object with the user-wise collaborative data</returns> static public IPosOnlyFeedback Read(TextReader reader, float rating_threshold, IMapping user_mapping = null, IMapping item_mapping = null, bool ignore_first_line = false) { if (user_mapping == null) user_mapping = new IdentityMapping(); if (item_mapping == null) item_mapping = new IdentityMapping(); if (ignore_first_line) reader.ReadLine(); var feedback = new PosOnlyFeedback<SparseBooleanMatrix>(); string line; while ((line = reader.ReadLine()) != null) { if (line.Trim().Length == 0) continue; string[] tokens = line.Split(Constants.SPLIT_CHARS); if (tokens.Length < 3) throw new FormatException("Expected at least 3 columns: " + line); int user_id = user_mapping.ToInternalID(tokens[0]); int item_id = item_mapping.ToInternalID(tokens[1]); float rating = float.Parse(tokens[2], CultureInfo.InvariantCulture); if (rating >= rating_threshold) feedback.Add(user_id, item_id); } return feedback; }
/// <summary>Read in static rating data from a file</summary> /// <param name="filename">the name of the file to read from</param> /// <param name="user_mapping">mapping object for user IDs</param> /// <param name="item_mapping">mapping object for item IDs</param> /// <param name="rating_type">the data type to be used for storing the ratings</param> /// <param name="ignore_first_line">if true, ignore the first line</param> /// <returns>the rating data</returns> public static IRatings Read( string filename, IMapping user_mapping = null, IMapping item_mapping = null, RatingType rating_type = RatingType.FLOAT, bool ignore_first_line = false) { string binary_filename = filename + ".bin.StaticRatings"; if (FileSerializer.Should(user_mapping, item_mapping) && File.Exists(binary_filename)) return (IRatings) FileSerializer.Deserialize(binary_filename); int size = 0; using ( var reader = new StreamReader(filename) ) while (reader.ReadLine() != null) size++; if (ignore_first_line) size--; return Wrap.FormatException<IRatings>(filename, delegate() { using ( var reader = new StreamReader(filename) ) { var ratings = (StaticRatings) Read(reader, size, user_mapping, item_mapping, rating_type); if (FileSerializer.Should(user_mapping, item_mapping) && FileSerializer.CanWrite(binary_filename)) ratings.Serialize(binary_filename); return ratings; } }); }
/// <summary>Read in rating data from a TextReader</summary> /// <param name="reader">the <see cref="TextReader"/> to read from</param> /// <param name="user_mapping">mapping object for user IDs</param> /// <param name="item_mapping">mapping object for item IDs</param> /// <returns>the rating data</returns> public static ITimedRatings Read(TextReader reader, IMapping user_mapping = null, IMapping item_mapping = null) { if (user_mapping == null) user_mapping = new IdentityMapping(); if (item_mapping == null) item_mapping = new IdentityMapping(); var ratings = new TimedRatings(); string[] separators = { "::" }; string line; while ((line = reader.ReadLine()) != null) { string[] tokens = line.Split(separators, StringSplitOptions.None); if (tokens.Length < 4) throw new FormatException(string.Format("Expected at least 4 columns: {0}", line)); int user_id = user_mapping.ToInternalID(tokens[0]); int item_id = item_mapping.ToInternalID(tokens[1]); float rating = float.Parse(tokens[2], CultureInfo.InvariantCulture); long seconds = uint.Parse(tokens[3]); var time = new DateTime(seconds * 10000000L).AddYears(1969); var offset = TimeZone.CurrentTimeZone.GetUtcOffset(time); time -= offset; ratings.Add(user_id, item_id, rating, time); } return ratings; }
public override SqlType[] SqlTypes(IMapping mapping) { if (compression == null) return new SqlType[] { new StringClobSqlType() }; else return new SqlType[] { new BinaryBlobSqlType() }; }
public CompositeElementPropertyMapping(string[] elementColumns, string[] elementFormulaTemplates, IAbstractComponentType compositeType, IMapping factory) { this.compositeType = compositeType; InitComponentPropertyPaths(null, compositeType, elementColumns, elementFormulaTemplates, factory); }
public override string SqlTriggerBody( Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema) { var auditTableName = dialect.QuoteForTableName(_auditTableName); var eDialect = (IExtendedDialect)dialect; string triggerSource = _action == TriggerActions.DELETE ? eDialect.GetTriggerOldDataAlias() : eDialect.GetTriggerNewDataAlias(); var columns = new List<string>(_dataColumnNames); columns.AddRange(from ac in _auditColumns select ac.Name); var values = new List<string>(); values.AddRange( from columnName in _dataColumnNames select eDialect.QualifyColumn( triggerSource, columnName)); values.AddRange( from auditColumn in _auditColumns select auditColumn.ValueFunction.Invoke(_action)); return eDialect.GetInsertIntoString(auditTableName, columns, triggerSource, values); }
/// <summary> /// Applies the modification to a particular mapping. /// </summary> /// <param name="mapping">The mapping to which the modification should be applied</param> public void ApplyTo(IMapping mapping) { HandleMapping(mapping); HandleColumnMappings(mapping.Mappings.OfType<IColumnMapping>()); HandleHasManyMappings(mapping.Mappings.OfType<IHasManyMapping>()); HandleHasOneMappings(mapping.Mappings.OfType<IHasOneMapping>()); HandleBelongsToMappings(mapping.Mappings.OfType<IBelongsToMapping>()); }
public FunctionStack(IMapping mapping) { if (mapping == null) { throw new ArgumentNullException("mapping"); } this.mapping = mapping; }
public IEnumerable<string> GetIdsForBackTrack(IMapping sessionFactory) { int paremeterSpan = keyType.GetColumnSpan(sessionFactory); for (int i = 0; i < paremeterSpan; i++) { yield return string.Format(CollectionFilterParameterIdTemplate, collectionRole, queryParameterPosition, i); } }
public override IEnumerable<string> GetIdsForBackTrack(IMapping sessionFactory) { int paremeterSpan = GetParemeterSpan(sessionFactory); for (int i = 0; i < paremeterSpan; i++) { yield return string.Format(NamedParameterIdTemplate, name, i); } }
protected int GetParemeterSpan(IMapping sessionFactory) { if (sessionFactory == null) { throw new ArgumentNullException("sessionFactory"); } return ExpectedType.GetColumnSpan(sessionFactory); }
public override void Validate(IMapping mapping) { base.Validate(mapping); if (Key != null && !Key.IsValid(mapping)) { throw new MappingException(string.Format("subclass key has wrong number of columns: {0} type: {1}", MappedClass.Name, Key.Type.Name)); } }
/// <summary> /// Initializes a new instance of the <see cref="HttpDataSource"/> type. /// </summary> /// <param name="container">The container.</param> /// <param name="mapping">The mapping.</param> public HttpDataSource(IContainer container, IMapping mapping) : base(container) { mapping = Enforce.NotNull(mapping, () => mapping); // Set the mapping. this.Mapping = mapping; }
/// <summary> /// /// </summary> /// <param name="mapping"></param> public override void Validate( IMapping mapping ) { base.Validate( mapping ); if ( !Identifier.IsValid( mapping ) ) { throw new MappingException( string.Format( "collection id mapping has wrong number of columns: {0} type: {1}", Role, Identifier.Type.Name ) ); } }
public Map MakeMap() { if (_mapping == null) _mapping = _configuration.BuildMapping(); var map = new Map(); foreach (var classMap in BuildMappings()) map.Add(classMap); return map; }
/// <summary> /// Get the columns of the owning entity which are to /// be used in the join /// </summary> public static string[] GetLHSColumnNames( IAssociationType type, int property, IOuterJoinLoadable lhsPersister, IMapping mapping ) { return GetLHSColumnNames(type, property, 0, lhsPersister, mapping); }
public override int GetColumnSpan(IMapping mapping) { int span = 0; for (int i = 0; i < propertySpan; i++) { span += propertyTypes[i].GetColumnSpan(mapping); } return span; }
public PropertyMapping(ScalarProperty property, IMapping mapping, EntityType table) { if (property == null || mapping == null) throw new ArgumentNullException(); Property = property; Mapping = mapping; Table = table; if (BusinessPropertyMapping != null) _column = BusinessPropertyMapping.Column; }
private IType GetReferencedType(IMapping mapping) { if (uniqueKeyPropertyName == null) { return mapping.GetIdentifierType(AssociatedClass); } else { return mapping.GetPropertyType(AssociatedClass, uniqueKeyPropertyName); } }
public override string SqlCreateString(Dialect.Dialect dialect, IMapping p, string defaultCatalog, string defaultSchema) { if (dialect.SupportsUniqueConstraintInCreateAlterTable) { return base.SqlCreateString(dialect, p, defaultCatalog, defaultSchema); } else { return Index.BuildSqlCreateIndexString(dialect, Name, Table, ColumnIterator, true, defaultCatalog, defaultSchema); } }
/// <summary> /// /// </summary> /// <param name="mapping"></param> /// <returns></returns> public override SqlType[] SqlTypes(IMapping mapping) { return(sqlTypes); }
public Handler(IAccountContext accountContext, IMapping mapper) : base(accountContext, mapper) { }
public bool[] ToColumnNullness(object value, IMapping mapping) { throw new NotImplementedException(); }
public SocketForTest(IMapping mapping) : base() { Mapping = mapping; }
public AddPaymentInfoToCart(IBasketService basketService) { _basketService = basketService; _paymentMapper = ObjectFactory.Instance.Resolve <IMapping <ICollection <Payment>, IList <PaymentInfo> > >(); _purchaseOrderMapper = ObjectFactory.Instance.Resolve <IMapping <PurchaseOrder, Cart> >(); }
public SetCartAdjustmentsValuesFromDiscounts(IMapping <Discount, CartAdjustment> discountToAdjustment) { _discountToAdjustment = discountToAdjustment; }
/// <summary> /// Returns the right IHttpHandler for the current request /// </summary> /// <param name="context">The current HttpContext</param> /// <param name="requestType">The current RequestType (HTTP verb)</param> /// <param name="url">The requestes Url</param> /// <param name="pathTranslated">The translated physical path</param> /// <param name="container">The container.</param> /// <returns>The right IHttpHandler instance for the current request</returns> protected override IHttpHandler GetHandlerCore(HttpContext context, string requestType, string url, string pathTranslated, IContainer container) { context = Enforce.NotNull(context, () => context); requestType = Enforce.NotNullOrEmpty(requestType, () => requestType); url = Enforce.NotNullOrEmpty(url, () => url); pathTranslated = Enforce.NotNullOrEmpty(pathTranslated, () => pathTranslated); // Get the mapping for the requested name. IMapping mapping = null; // Try fetch the Mapping with identifier. string id = this.Data.Trim('/'); if (id != null && id.IsGuid()) { mapping = this._mappingService.ReadMapping( SessionFacade.GetSessionValue <IUser>(SessionFacadeKey.CurrentlyLoggedOnUser), id.ToOrDefault <Guid>()); if (mapping == null) { throw new SilkveilException(String.Format(CultureInfo.CurrentCulture, "The id '{0}' is invalid.", id)); } } else { // Try fetch the Mapping with name. if (!String.IsNullOrEmpty(id)) { mapping = this._mappingService.ReadMappingByName( SessionFacade.GetSessionValue <IUser>(SessionFacadeKey.CurrentlyLoggedOnUser), id); if (mapping == null) { throw new SilkveilException(String.Format(CultureInfo.CurrentCulture, "The name '{0}' is invalid.", id)); } } } // No valid guid or name is provided, fail. if (mapping == null) { throw new MappingNotFoundException( String.Format( CultureInfo.CurrentCulture, "There was no mapping found for ID '{0}'.", id)); } // Get the data source that holds the download and write the download to the output stream. IDataSource dataSource = DataSourceFactory.GetMappedDataSource(mapping, container); DownloadHandler handler = new DownloadHandler(); // Grab the right Handler correnspondents to our Mapping, if there any source authentication set if (mapping.SourceAuthentication != null) { switch (mapping.SourceAuthentication.AuthenticationType) { case AuthenticationType.HttpBasicAuthentication: handler.AuthenticationStrategy = new HttpBasicAuthentication(); break; case AuthenticationType.HttpDigestAuthentication: handler.AuthenticationStrategy = new HttpDigestAuthentication(); break; } // Set properties needed for the autentication strategy. handler.AuthenticationStrategy.Realm = mapping.Id.ToString(); handler.AuthenticationStrategy.UserName = mapping.SourceAuthentication.UserName; handler.AuthenticationStrategy.Password = mapping.SourceAuthentication.Password; } // Set Mapping and DataSource to the handlers properties handler.Mapping = mapping; handler.DataSource = dataSource; return(handler); }
/// <summary> /// Constructor /// </summary> /// <param name="expression">Expression used to point to the property</param> /// <param name="mapping">Mapping the StringID is added to</param> protected ManyClassPropertyBase(Expression <Func <TClassType, IList <TDataType> > > expression, IMapping mapping) { if (expression is null) { throw new ArgumentNullException(nameof(expression)); } Name = expression.PropertyName(); CompiledExpression = expression.Compile(); Expression = expression; InternalFieldName = "_" + Name + "Derived"; ParentMapping = mapping ?? throw new ArgumentNullException(nameof(mapping)); PropertyType = typeof(TDataType); TypeName = PropertyType.GetName(); }
/// <summary> /// /// </summary> /// <param name="session"></param> /// <returns></returns> public override int GetColumnSpan(IMapping session) { return(sqlTypes.Length); }
/// <summary> /// Generates the SQL string to create this Table in the database. /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param> /// <param name="p"></param> /// <param name="defaultSchema"></param> /// <returns> /// A string that contains the SQL to create this Table, Primary Key Constraints /// , and Unique Key Constraints. /// </returns> public string SqlCreateString(Dialect.Dialect dialect, IMapping p, string defaultSchema) { StringBuilder buf = new StringBuilder("create table ") .Append(GetQualifiedName(dialect, defaultSchema)) .Append(" ("); bool identityColumn = idValue != null && idValue.CreateIdentifierGenerator(dialect) is IdentityGenerator; // try to find out the name of the pk to create it as identity if the // identitygenerator is used string pkname = null; if (primaryKey != null && identityColumn) { foreach (Column col in primaryKey.ColumnCollection) { pkname = col.GetQuotedName(dialect); //should only go through this loop once } } int i = 0; foreach (Column col in ColumnCollection) { i++; buf.Append(col.GetQuotedName(dialect)) .Append(' ') .Append(col.GetSqlType(dialect, p)); if (identityColumn && col.GetQuotedName(dialect).Equals(pkname)) { buf.Append(' ') .Append(dialect.IdentityColumnString); } else { if (col.IsNullable) { buf.Append(dialect.NullColumnString); } else { buf.Append(" not null"); } } if (col.IsUnique) { if (dialect.SupportsUnique) { buf.Append(" unique"); } else { UniqueKey uk = GetUniqueKey(col.GetQuotedName(dialect) + "_"); uk.AddColumn(col); } } if (i < ColumnCollection.Count) { buf.Append(StringHelper.CommaSpace); } } if (primaryKey != null) { //if ( dialect is HSQLDialect && identityColumn ) { // // skip the primary key definition // //ugly hack... //} else { buf.Append(',').Append(primaryKey.SqlConstraintString(dialect, defaultSchema)); //} } foreach (UniqueKey uk in UniqueKeyCollection) { buf.Append(',').Append(uk.SqlConstraintString(dialect)); } buf.Append(StringHelper.ClosedParen); return(buf.ToString()); }
public override SqlType[] SqlTypes(IMapping mapping) { return(NHibernateUtil.String.SqlTypes(mapping)); }
public override bool[] ToColumnNullness(object value, IMapping mapping) { return(NHibernateUtil.String.ToColumnNullness(value, mapping)); }
/// <summary> /// Gets the name of the data type for the column. /// </summary> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to use to get the valid data types.</param> /// <param name="mapping"></param> /// <returns> /// The name of the data type for the column. /// </returns> /// <remarks> /// If the mapping file contains a value of the attribute <c>sql-type</c> this will /// return the string contained in that attribute. Otherwise it will use the /// typename from the <see cref="Dialect.Dialect"/> of the <see cref="SqlType"/> object. /// </remarks> public string GetSqlType(Dialect.Dialect dialect, IMapping mapping) { return(_sqlType ?? GetDialectTypeName(dialect, mapping)); }
public IType ReturnType(IType columnType, IMapping mapping) { return(NHibernateUtil.Int32); }
private void SetupJoiningTablesEnumerable(IMapping Mapping, IProperty Property, IDatabase Key, SQL.DataClasses.Database TempDatabase) { if (TempDatabase.Tables.FirstOrDefault(x => x.Name == Property.TableName) != null) { return; } IMapping MapMapping = Mappings[Key].FirstOrDefault(x => x.ObjectType == Property.Type); if (MapMapping == Mapping) { TempDatabase.AddTable(Property.TableName); TempDatabase[Property.TableName].AddColumn("ID_", DbType.Int32, 0, false, true, true, true, false, "", "", ""); TempDatabase[Property.TableName].AddColumn(Mapping.TableName + Mapping.IDProperty.FieldName, Mapping.IDProperty.Type.To(DbType.Int32), Mapping.IDProperty.MaxLength, false, false, false, false, false, Mapping.TableName, Mapping.IDProperty.FieldName, "", false, false, false); TempDatabase[Property.TableName].AddColumn(MapMapping.TableName + MapMapping.IDProperty.FieldName + "2", MapMapping.IDProperty.Type.To(DbType.Int32), MapMapping.IDProperty.MaxLength, false, false, false, false, false, MapMapping.TableName, MapMapping.IDProperty.FieldName, "", false, false, false); } else { TempDatabase.AddTable(Property.TableName); TempDatabase[Property.TableName].AddColumn("ID_", DbType.Int32, 0, false, true, true, true, false, "", "", ""); TempDatabase[Property.TableName].AddColumn(Mapping.TableName + Mapping.IDProperty.FieldName, Mapping.IDProperty.Type.To(DbType.Int32), Mapping.IDProperty.MaxLength, false, false, false, false, false, Mapping.TableName, Mapping.IDProperty.FieldName, "", true, false, false); TempDatabase[Property.TableName].AddColumn(MapMapping.TableName + MapMapping.IDProperty.FieldName, MapMapping.IDProperty.Type.To(DbType.Int32), MapMapping.IDProperty.MaxLength, false, false, false, false, false, MapMapping.TableName, MapMapping.IDProperty.FieldName, "", true, false, false); } }
/// <inheritdoc /> public override IType GetEffectiveReturnType(IEnumerable <IType> argumentTypes, IMapping mapping, bool throwOnError) { return(_modulusFunctionTypeDetector.GetReturnType(argumentTypes, mapping, throwOnError)); }
/// <summary> /// Constructor /// </summary> /// <param name="Expression">Expression pointing to the property</param> /// <param name="Mapping">Mapping the StringID is added to</param> public Reference(Expression <Func <ClassType, DataType> > Expression, IMapping Mapping) : base(Expression, Mapping) { SetDefaultValue(() => default(DataType)); SetFieldName(Name + "_"); }
public CustomPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping) { this.factory = factory; }
public int GetColumnSpan(IMapping mapping) { return(1); }
/// <summary> Convenience method to locate the identifier type of the associated entity. </summary> /// <param name="factory">The mappings... </param> /// <returns> The identifier type </returns> internal virtual IType GetIdentifierType(IMapping factory) { return(factory.GetIdentifierType(GetAssociatedEntityName())); }
public bool[] ToColumnNullness(object value, IMapping mapping) { return(RealType.ToColumnNullness(value, mapping)); }
public object FromXMLNode(XmlNode xml, IMapping factory) { return(RealType.FromXMLNode(xml, factory)); }
public object FromXMLNode(XmlNode xml, IMapping factory) { throw new NotImplementedException(); }
public IType ReturnType(IType columnType, IMapping mapping) { //note there is a weird implementation in the client side //TODO: cast that use only costant are not supported in SELECT. Ex: cast(5 as string) return(SetLazyType(columnType)); }
public SqlType[] SqlTypes(IMapping mapping) { return(x); }
public int GetColumnSpan(IMapping mapping) { return(RealType.GetColumnSpan(mapping)); }
/// <inheritdoc /> public IType GetEffectiveReturnType(IEnumerable <IType> argumentTypes, IMapping mapping, bool throwOnError) { return(GetReturnType(argumentTypes, mapping, throwOnError)); }
public SqlType[] SqlTypes(IMapping mapping) { return(RealType.SqlTypes(mapping)); }
/// <summary> /// Initiates the process for the given mechanism. The atoms to apply are mapped between /// reactants and products. /// </summary> /// <param name="atomContainerSet"></param> /// <param name="atomList"> /// The list of atoms taking part in the mechanism. Only allowed two atoms. /// The first atom is the atom which must be moved and the second /// is the atom which receives the atom1 and the third is the atom which loss /// the first atom</param> /// <param name="bondList">The list of bonds taking part in the mechanism. Only allowed one bond. /// It is the bond which is moved</param> /// <returns>The Reaction mechanism</returns> public IReaction Initiate(IChemObjectSet <IAtomContainer> atomContainerSet, IList <IAtom> atomList, IList <IBond> bondList) { var atMatcher = CDK.AtomTypeMatcher; if (atomContainerSet.Count != 1) { throw new CDKException("RadicalSiteRearrangementMechanism only expects one IAtomContainer"); } if (atomList.Count != 3) { throw new CDKException("RadicalSiteRearrangementMechanism expects three atoms in the List"); } if (bondList.Count != 1) { throw new CDKException("RadicalSiteRearrangementMechanism only expect one bond in the List"); } IAtomContainer molecule = atomContainerSet[0]; IAtomContainer reactantCloned; reactantCloned = (IAtomContainer)molecule.Clone(); IAtom atom1 = atomList[0]; // Atom to be moved IAtom atom1C = reactantCloned.Atoms[molecule.Atoms.IndexOf(atom1)]; IAtom atom2 = atomList[1]; // Atom to receive the new bonding with a ISingleElectron IAtom atom2C = reactantCloned.Atoms[molecule.Atoms.IndexOf(atom2)]; IAtom atom3 = atomList[2]; // Atom which loss the atom IAtom atom3C = reactantCloned.Atoms[molecule.Atoms.IndexOf(atom3)]; IBond bond1 = bondList[0]; // Bond to move int posBond1 = molecule.Bonds.IndexOf(bond1); reactantCloned.Bonds.Remove(reactantCloned.Bonds[posBond1]); IBond newBond = atom1.Builder.NewBond(atom1C, atom2C, BondOrder.Single); reactantCloned.Bonds.Add(newBond); var selectron = reactantCloned.GetConnectedSingleElectrons(atom2C); reactantCloned.SingleElectrons.Remove(selectron.Last()); atom2C.Hybridization = Hybridization.Unset; AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(reactantCloned); IAtomType type = atMatcher.FindMatchingAtomType(reactantCloned, atom2C); if (type == null || type.AtomTypeName.Equals("X", StringComparison.Ordinal)) { return(null); } reactantCloned.SingleElectrons.Add(atom2C.Builder.NewSingleElectron(atom3C)); atom3C.Hybridization = Hybridization.Unset; AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(reactantCloned); type = atMatcher.FindMatchingAtomType(reactantCloned, atom3C); if (type == null || type.AtomTypeName.Equals("X", StringComparison.Ordinal)) { return(null); } IReaction reaction = atom2C.Builder.NewReaction(); reaction.Reactants.Add(molecule); /* mapping */ foreach (var atom in molecule.Atoms) { IMapping mapping = atom2C.Builder.NewMapping(atom, reactantCloned.Atoms[molecule.Atoms.IndexOf(atom)]); reaction.Mappings.Add(mapping); } reaction.Products.Add(reactantCloned); return(reaction); }
/// <summary> /// Converts this instance to the class specified /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="mapping">The mapping.</param> /// <returns>The resulting property</returns> public abstract IManyToManyProperty Convert <TResult>(IMapping mapping) where TResult : class;