示例#1
0
        //private List<string> _includeNames = new List<string>();

        public SDataQuery(SDataQueryProvider <TEntity> provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            _provider   = provider;
            _expression = Expression.Constant(this);
        }
示例#2
0
        public SDataQuery(SDataQueryProvider <TEntity> provider, Expression expression)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            if (!typeof(IQueryable <TReturnElement>).IsAssignableFrom(expression.Type))
            {
                throw new ArgumentOutOfRangeException("expression");
            }

            _provider   = provider;
            _expression = expression;
        }
        public TEntity Create <TEntity>()
        {
            Type entityType = SDataQueryProvider <TEntity> .FindConcreteEntityType();

            return((TEntity)Activator.CreateInstance(entityType));
        }
        public TEntity GetEntityById <TEntity>(string id)
        {
            var provider = new SDataQueryProvider <TEntity>(_sdataContractUrl, _userName, _password, this);

            return(provider.GetEntity(id));
        }