NamedSchema

Namespace: Avro
We found 10 examples in language CSharp for this search. You will see 16 fragments of code.

Other methods


        public override bool Equals(AvroSchema other)
        {
            return (other is NamedSchema) &&
                (other as NamedSchema).FullName == FullName
            ;
        }


        private static AvroSchema ParseUnionSchema(JToken jToken, IDictionary<string, NamedSchema> namedTypes, Stack<string> enclosingNamespace)
        {
            var jArray = jToken as JArray;
            var unionSchema = new UnionSchema();
            foreach (var item in jArray)
            {
                var schema = ParseSchema(item, namedTypes, enclosingNamespace);
                unionSchema.Add(schema);
            }
            return unionSchema;
        }


        public bool TryGetValue(string s, out NamedSchema schema)
        {
            Name name = new Name(s, this.Space);

            return TryGetValue(name, out schema);
        }


        public new void Add(Name name, NamedSchema schema)
        {
            if (null == name) throw new ArgumentNullException("name", "name cannot be null.");
            if (base.ContainsKey(name))
                throw new SchemaParseException("Can't redefine: " + name);

            base.Add(name, schema);
        }

        public bool Contains(Schema schema)
        {
            if (!(schema is NamedSchema))
                return false;

            return ContainsKey(((NamedSchema)schema).name);
        }

        public void Add(NamedSchema schema)
        {
            if (null == schema) throw new ArgumentNullException("schema", "schema cannot be null.");
            Add(schema.name, schema);
        }


        public void AddType(NamedSchema schema)
        {
            if (string.IsNullOrEmpty(schema.Namespace))
                schema.Namespace = Namespace;
            if (_types.Contains(schema))
                throw new AvroException($"Protocol already contains the type: '{schema.FullName}'");
            _types.Add(schema);
        }


        #endregion

        #region Public static members

        public static string GetCode(NamedSchema schema)
        {
            var codeGen = new CodeGen();
            codeGen.AddSchema(schema);
            var codeBuilder = new StringBuilder();
            using (var codeWriter = new StringWriter(codeBuilder))
                codeGen.WriteCode(codeWriter);
            return codeBuilder.ToString();
        }

        public static Assembly Compile(string assemblyName, NamedSchema schema, out XmlDocument xmlDocumentation)
        {
            var code = GetCode(schema);
            return Compile(assemblyName, code, out xmlDocumentation);
        }


    private static string GetNamespace(JToken type, NamedSchema parentSchema, string name)
    {
        var @namespace = type.OptionalProperty<string>(Token.Namespace);
        if (string.IsNullOrEmpty(@namespace) && !name.Contains('.') && parentSchema != null)
        {
            @namespace = parentSchema.Namespace;
        }
        return @namespace;
    }


        /// <summary>
        /// Adds a named schema to the list
        /// </summary>
        /// <param name="schema">schema object</param>
        /// <returns>true if schema was added to the list, false if schema is already in the list</returns>
        public bool Add(NamedSchema schema)
        {
            SchemaName name = schema.SchemaName;
            return Add(name, schema);
        }

        /// <summary>
        /// Returns the enumerator for the map
        /// </summary>
        /// <returns></returns>
        public IEnumerator<KeyValuePair<SchemaName, NamedSchema>> GetEnumerator()
        {
            return Names.GetEnumerator();
        }


        private string GetNamespace(JObject type, NamedSchema parentSchema, string name)
        {
            var nspace = type.OptionalProperty<string>(Token.Namespace);
            if (string.IsNullOrEmpty(nspace) && !name.Contains(".") && parentSchema != null)
            {
                nspace = parentSchema.Namespace;
            }
            return nspace;
        }


        /// <summary>
        /// Adds a named schema to the list
        /// </summary>
        /// <param name="schema">schema object</param>
        /// <returns>true if schema was added to the list, false if schema is already in the list</returns>
        public bool Add(NamedSchema schema)
        {
            SchemaName name = schema.SchemaName;
            return Add(name, schema);
        }

        /// <summary>
        /// Returns the enumerator for the map
        /// </summary>
        /// <returns></returns>
        public IEnumerator<KeyValuePair<SchemaName, NamedSchema>> GetEnumerator()
        {
            return Names.GetEnumerator();
        }


        private string GetNamespace(JObject type, NamedSchema parentSchema, string name)
        {
            var nspace = type.OptionalProperty<string>(Token.Namespace);
            if (string.IsNullOrEmpty(nspace) && !name.Contains(".") && parentSchema != null)
            {
                nspace = parentSchema.Namespace;
            }
            return nspace;
        }

Avro.NamedSchema : Schema

Methods :

public SchemaName get_SchemaName()
public String get_Name()
public String get_Namespace()
public String get_Fullname()
public Type get_Tag()
public String ToString()
public String GetProperty(String key = )
public Int32 GetHashCode()
public Boolean CanRead(Schema writerSchema = )
public Type GetType()
public Boolean Equals(Object obj = )