public IdentificationDescriptor(byte[] buffer, int offset) { ProtocolIdentifier = (ProtocolName)((buffer[offset + 0] >> 4) & 0x0F); CodeSet = (CodeSetName)(buffer[offset + 0] & 0x0F); PIV = (buffer[offset + 1] & 0x80) != 0; Association = (AssociationName)((buffer[offset + 1] >> 4) & 0x03); IdentifierType = (IdentifierTypeName)(buffer[offset + 1] & 0x0F); IdentifierLength = buffer[offset + 3]; Identifier = new byte[IdentifierLength]; Array.Copy(buffer, offset + 4, Identifier, 0, IdentifierLength); }
/// <summary> /// Gets the name of the association. /// </summary> /// <param name="dbManyName">Name of the db many.</param> /// <param name="dbOneName">Name of the db one.</param> /// <param name="dbConstraintName">Name of the db constraint.</param> /// <param name="foreignKeyName">Name of the foreign key.</param> /// <param name="extraction">The extraction.</param> /// <param name="nameFormat">The name format.</param> /// <returns></returns> public AssociationName GetAssociationName(string dbManyName, string dbOneName, string dbConstraintName, string foreignKeyName, WordsExtraction extraction, NameFormat nameFormat) { var words = GetLanguageWords(nameFormat.Culture); var associationName = new AssociationName { DbName = dbManyName }; associationName.NameWords = ExtractWords(words, dbManyName, extraction); associationName.ManyToOneMemberName = Format(words, dbOneName, nameFormat.Case, GetSingularization(Singularization.Singular, nameFormat)); // TODO: this works only for PascalCase if (dbManyName == dbOneName) { associationName.ManyToOneMemberName = foreignKeyName.Replace(',', '_') + associationName.ManyToOneMemberName; } // TODO: support new extraction associationName.OneToManyMemberName = Format(words, dbManyName, nameFormat.Case, GetSingularization(Singularization.Plural, nameFormat)); return(associationName); }
/// <summary> /// Gets the name of the association. /// </summary> /// <param name="dbManyName">Name of the db many.</param> /// <param name="dbOneName">Name of the db one.</param> /// <param name="dbConstraintName">Name of the db constraint.</param> /// <param name="foreignKeyName">Name of the foreign key.</param> /// <param name="extraction">The extraction.</param> /// <param name="nameFormat">The name format.</param> /// <returns></returns> public AssociationName GetAssociationName(string dbManyName, string dbOneName, string dbConstraintName, string foreignKeyName, WordsExtraction extraction, NameFormat nameFormat) { var words = GetLanguageWords(nameFormat.Culture); var associationName = new AssociationName { DbName = dbManyName }; associationName.NameWords = ExtractWords(words, dbManyName, extraction); associationName.ManyToOneMemberName = Format(words, dbOneName, nameFormat.Case, GetSingularization(Singularization.Singular, nameFormat)); // TODO: this works only for PascalCase if (dbManyName == dbOneName) associationName.ManyToOneMemberName = foreignKeyName.Replace(',', '_') + associationName.ManyToOneMemberName; // TODO: support new extraction associationName.OneToManyMemberName = Format(words, dbManyName, nameFormat.Case, GetSingularization(Singularization.Plural, nameFormat)); return associationName; }