コード例 #1
0
 public virtual void TestTypedItem()
 {
     var typedItem = new TypedItem
         ();
     typedItem.list = new ArrayList();
     Store(typedItem);
     Db4oAssert.PersistedCount(1, typeof (ArrayList));
 }
コード例 #2
0
        public virtual void TestTypedItem()
        {
            var typedItem = new TypedItem
                                ();

            typedItem.list = new ArrayList();
            Store(typedItem);
            Db4oAssert.PersistedCount(1, typeof(ArrayList));
        }
コード例 #3
0
        public void SetSelectedTagsFilter()
        {
            var found = TagsFilterSelections.FirstOrDefault(p => p.Key.Equals(Settings.SelectedDomain.MinimumTagCount.ToString()));

            if (found != null)
            {
                _SelectedTagsFilter = found;
                OnPropertyChanged("SelectedTagsFilter");
            }
        }
コード例 #4
0
ファイル: ExtensionMethods.cs プロジェクト: eXtensoft/xf-1.0
        private static BsonValue ToBsonValue(this TypedItem item)
        {
            BsonValue bson = null;
            Type      type = item.Value.GetType();

            switch (type.Name.ToLower())
            {
            case "string":
                bson = new BsonString(item.Value.ToString());
                break;

            case "datetime":
                bson = new BsonDateTime((DateTime)item.Value);
                break;

            case "int16":
            case "int32":
                bson = new BsonInt32((Int32)item.Value);
                break;

            case "int64":
                bson = new BsonInt64((Int64)item.Value);
                break;

            case "double":
                bson = new BsonDouble((double)item.Value);
                break;

            case "boolean":
                bson = new BsonBoolean((bool)item.Value);
                break;

            case "byte[]":
                bson = new BsonObjectId((byte[])item.Value);
                break;

            default:
                bson = new BsonString(item.Value.ToString());
                break;
            }
            return(bson);
        }
コード例 #5
0
ファイル: WebApiCaller.cs プロジェクト: eXtensoft/xf-2.0
        private static bool TryGetValueInternal <T>(string key, bool isCustom, out T t)
        {
            bool b = false;

            t = default(T);
            string internalKey = isCustom ? String.Format(KeyPattern, key.Trim().ToLower()) : key.Trim().ToLower();
            var    principal   = Thread.CurrentPrincipal as eXtensibleClaimsPrincipal;

            if (principal != null)
            {
                if (principal.Items != null)
                {
                    List <TypedItem> items = principal.Items.ToList();
                    for (int i = 0; !b && i < items.Count; i++)
                    {
                        if (items[i].Key.Equals(internalKey, StringComparison.OrdinalIgnoreCase))
                        {
                            TypedItem item = principal.Items.First(x => x.Key.Equals(internalKey, StringComparison.OrdinalIgnoreCase));

                            if (item != null)
                            {
                                try
                                {
                                    t = (T)item.Value;
                                    b = true;
                                }
                                catch (Exception ex)
                                {
                                    string s = ex.Message;
                                }
                            }
                        }
                    }
                }
            }



            return(b);
        }
コード例 #6
0
ファイル: ExtensionMethods.cs プロジェクト: eXtensoft/xf-1.0
        private static IMongoQuery ToMongoQuery(TypedItem item)
        {
            IMongoQuery query = null;

            switch (item.Operator)
            {
            case OperatorTypeOption.None:
            case OperatorTypeOption.EqualTo:
                query = Query.EQ(item.Key, item.ToBsonValue());    //object to BsonValue
                break;

            case OperatorTypeOption.NotEqualTo:
                query = Query.NE(item.Key, item.ToBsonValue());
                break;

            case OperatorTypeOption.LessThan:
                query = Query.LT(item.Key, item.ToBsonValue());
                break;

            case OperatorTypeOption.GreaterThan:
                query = Query.GT(item.Key, item.ToBsonValue());
                break;

            case OperatorTypeOption.X:
                break;

            case OperatorTypeOption.And:
                break;

            case OperatorTypeOption.Or:
                break;

            default:
                query = Query.EQ(item.Key, item.ToBsonValue());
                break;
            }
            return(query);
        }