Source

main-vinayFork / Source / WebClient / Web.BizLogic / Model / MetadataDetail.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataUp.Web.BizLogic
{
    /// <summary>
    /// Class that represents Metadata.
    /// </summary>
    public class MetadataDetail
    {
        public string Name { get; set; }

        public string Type { get; set; }

        public bool IsRequired { get; set; }

        public string Description { get; set; }

        public string Value { get; set; }
    }

    /// <summary>
    /// Class that represents Parameter Metadata.
    /// </summary>
    public class ParameterMetadataDetail
    {
        public string EntityName { get; set; }

        public string EntityDescription { get; set; }

        public List<ParameterAttribute> AttributeList { get; set; }
    }

    public class ParameterAttribute
    {
        public string Name { get; set; }

        public string Description { get; set; }

        public string Type { get; set; }

        public string Units { get; set; }
    }

    class ParameterAttributeComparer : IEqualityComparer<ParameterAttribute>
    {
        public bool Equals(ParameterAttribute x, ParameterAttribute y)
        {

            //Check whether the compared objects reference the same data. 
            if (Object.ReferenceEquals(x, y)) return true;

            //Check whether any of the compared objects is null. 
            if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
                return false;

            //Check whether the products' properties are equal. 
            return x.Name == y.Name && x.Description == y.Description && x.Type == y.Type && x.Units == y.Units;
        }

        // If Equals() returns true for a pair of objects  
        // then GetHashCode() must return the same value for these objects. 

        public int GetHashCode(ParameterAttribute attribute)
        {
            //Check whether the object is null 
            if (Object.ReferenceEquals(attribute, null)) return 0;

            int hashName = attribute.Name == null ? 0 : attribute.Name.GetHashCode();
            int hashDescCode = attribute.Description == null ? 0 : attribute.Description.GetHashCode();
            int hashTypeCode = attribute.Type == null ? 0 : attribute.Type.GetHashCode();
            int hashUnitsCode = attribute.Units == null ? 0 : attribute.Units.GetHashCode();
           
            //Calculate the hash code for the product. 
            return hashName ^ hashDescCode ^ hashTypeCode ^ hashUnitsCode;
        }

    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.