Beispiel #1
0
        public string GetIdForResource(object resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }
            var resourceId = IdProperty.GetValue(resource);

            if (resourceId == null)
            {
                throw new ArgumentException($"The ID for the provided `{ResourceTypeName}` resource is null.");
            }
            return(resourceId.ToString());
        }
Beispiel #2
0
        public override IAliasedCommandTypeDataOrder Lookup(TModel model)
        {
            Clause whereClause =
                Clause
                .New()
                .AddClause(
                    IdProperty.GetValue(model),
                    Clause.EqualStatementCallback(IdProperty.Name)
                    );

            var fields = typeof(TModel).GetProperties().Select(p => p.Name);

            var selectQuery =
                SelectQuery
                .New(TableName, fields, false)
                .Build(whereClause);

            return(new AliasedCommandTypeDataOrder(selectQuery, System.Data.CommandType.Text));
        }
 public string GetIdForResource(object resource)
 {
     return(IdProperty.GetValue(resource).ToString());
 }