Ejemplo n.º 1
0
        public void SupportedTypes()
        {
            KeyCollection keys = new KeyCollection(new string[] { "Product", "Category" });

            keys.Add(Int32Key.Create(1, "Product"));
            keys.Add(GuidKey.Create(Guid.NewGuid(), "Category"));
        }
Ejemplo n.º 2
0
        public void SupportedClasses()
        {
            KeyCollection keys = new KeyCollection(null, new Type[] { typeof(Int32Key), typeof(GuidKey) });

            keys.Add(Int32Key.Create(1, "Product"));
            keys.Add(GuidKey.Create(Guid.NewGuid(), "Category"));
        }
Ejemplo n.º 3
0
        public void AllSupportedKeyTypesAndClasses()
        {
            KeyCollection keys = new KeyCollection();

            keys.Add(Int32Key.Create(1, "Product"));
            keys.Add(GuidKey.Create(Guid.NewGuid(), "Category"));
        }
        private static bool TryGetGuidKey(IReadOnlyKeyValueCollection parameters, out GuidKey key)
        {
            if (parameters.TryGet("Type", out string type) && parameters.TryGet("Guid", out Guid guid))
            {
                key = GuidKey.Create(guid, type);
                return(true);
            }

            key = null;
            return(false);
        }
Ejemplo n.º 5
0
        public static GuidKey FindGuidKeyWithoutType(this KeyToParametersConverter converter, IReadOnlyKeyValueCollection parameters, string keyType, string prefix)
        {
            Ensure.NotNull(converter, "converter");
            GuidKey key;

            if (converter.TryGetWithoutType(parameters, keyType, prefix, out key))
            {
                return(key);
            }

            return(GuidKey.Empty(keyType));
        }