コード例 #1
0
 /// <summary>
 ///     Validate the <see cref = "EdmModel" /> and all of its properties given certain version.
 /// </summary>
 /// <param name = "root"> The root of the model to be validated </param>
 /// <param name = "validateSyntax"> True to validate the syntax, otherwise false </param>
 internal void Validate(Edm.EdmModel root, bool validateSyntax)
 {
     // Build up the validation context
     var context = new EdmModelValidationContext(validateSyntax);
     context.OnError += OnError;
     context.Validate(root);
 }
コード例 #2
0
 /// <summary>
 /// Send a XML file to the Data Exchange server. </summary>
 /// <param name="xml"> </param>
 /// <param name="parentPath"> </param>
 /// <param name="timestamp"> </param>
 /// <param name="charset"> </param>
 /// <exception cref="GeneralSecurityException"> </exception>
 /// <exception cref="IOException"> </exception>
 /// <exception cref="URISyntaxException"> </exception>
 /// <exception cref="NeotysAPIException"> </exception>
 /// <exception cref="ParserConfigurationException"> </exception>
 /// <exception cref="SAXException"> </exception>
 public void AddXMLEntries(string xml, IList <string> parentPath, long timestamp, string charset)
 {
     if (!Enabled)
     {
         return;
     }
     try
     {
         if (Edm.FindDeclaredType("com.neotys.neoload.api.dataexchange.XMLEntries") == null)
         {
             // NeoLoad 5.0 : parsing is done on Client side
             IList <Entry> entries = XMLEntries.FromXML(xml, parentPath, timestamp, charset);
             AddEntries(entries);
         }
         else
         {
             // From NeoLoad 5.1 : parsing is done on Server side
             IDictionary <string, object> properties = XMLEntries.ToProperties(xml, parentPath, timestamp, charset);
             properties[SessionIds.SESSION_ID] = sessionId;
             CreateEntity(XMLEntries.XMLENTRIES, properties);
         }
     }
     catch (Microsoft.OData.ODataException oDataException)
     {
         throw new NeotysAPIException(oDataException);
     }
 }
コード例 #3
0
        /// <summary>
        /// Common initialization
        /// </summary>
        /// <param name="member">MemberInfo</param>
        /// <param name="dataType">Type of property/field</param>
        private void CommonInit(System.Reflection.MemberInfo member, Type dataType)
        {
            Type = dataType;

            foreach (Attribute attribute in member.GetCustomAttributes(true))
            {
                if (attribute is PartitionKeyAttribute)
                {
                    IsPartitionKey = true;
                }
                else if (attribute is RowKeyAttribute)
                {
                    IsRowKey = true;
                }
                else if (attribute is ETagAttribute)
                {
                    IsETag = true;
                }
                else if (attribute is TimestampAttribute)
                {
                    IsTimestamp = true;
                }
                else if (attribute is TableColumnAttribute tc)
                {
                    // Now the problem is legacy code that may define columns we now have attributes for
                    // as TableColumn() with matching names. We do not want those anymore!
                    if (FixedColumnNames.Contains(tc.ColumnName))
                    {
                        throw new TypeLoadException($"{member.Name} is mapped to {tc.ColumnName} that has its own attribute. Use the '{tc.ColumnName}' attribute instead of specifying it as a column name!");
                    }

                    // Traditional column
                    TableEntityColumn = tc;
                }
            }

            Type?underlyingType = Nullable.GetUnderlyingType(Type);

            IsNullableType = (dataType == typeof(string)) || (underlyingType == typeof(string)) || (underlyingType != null);
            IsEdmType      = Edm.IsEdmCompatibleType(underlyingType ?? Type);
        }
コード例 #4
0
        private void GetAllModel()
        {
            foreach (Part pt in Session.GetSession().Parts)
            {
                string name = pt.Name;
                if (ParentAssmblieInfo.IsParent(pt))
                {
                    ParentAssmblieInfo parent = ParentAssmblieInfo.GetAttribute(pt);
                    switch (parent.Type)
                    {
                    case PartType.ASM:
                        Asm.Add(new ASMModel(pt));
                        break;

                    case PartType.EDM:
                        Edm.Add(new EDMModel(pt));
                        break;

                    case PartType.Electrode:
                        ElectrodeModel eleModel = new ElectrodeModel(pt);
                        Electrode.Add(eleModel);
                        break;

                    case PartType.Work:
                        Work.Add(new WorkModel(pt));
                        break;

                    default:
                        Other.Add(pt);
                        break;
                    }
                }
                else
                {
                    Other.Add(pt);
                }
            }
        }
コード例 #5
0
ファイル: NLinqVisitor.cs プロジェクト: npenin/uss
 public NLinqVisitor(Edm.Metadata metadata)
 {
     this.metadata = metadata;
     identifiers = new Dictionary<string, PropertyExpression>();
 }