Posts

c# - Returning multiple related entity types from raw SQL queries in Entity Framework -

noodling around raw sql queries in entity framework. right in thinking given these 2 related ef classes: public partial class campaign { public int campaignid { get; set; } public virtual icollection<quote> quotes { get; set; } } public partial class quote { public int quoteid { get; set; } public int campaignid { get; set; } public virtual campaign campaign { get; set; } } the tables joined foreign key, , objects generated db first entity framework. i can't issue raw query campaigns , related quotes? i've tried this: string sqlquery = "select * campaign c join quote q on q.campaignid = c.campaignid"; var meh = entities.database.sqlquery<campaign>(sqlquery); which brings campaigns without quotes. i'm guessing it's not feasible wanted check i'm not doing wrong? i couldn't find definitive answer in documentation. , older related question fetching complex objects raw sql query in entity framework has ...

WCF domain-specific contract, service and DTO separation -

we have multiple wcf services different domains/scopes (application-specific data, users, management etc.). automap entities dtos, here encounter first design issues. how could, , should, separate services, contracts , dtos? this tricky if need different views on same data - i.e. user might able read data himself, should not associated management-data since outside of scope. my initial approach have been put dtos , contracts separate assembly each domain, or rather each service (e.g. corecontracts , ordercontracts etc.). makes separation of different views on same data harder, if don't want add new services serve data these views. example (omitting attributes): public class userdto { public int userid {get; set;} public string username {get; set;} public string email {get; set} public string address {get; set;} public bool examplemanagementflag {get; set;} } this example , not how implemented the examplemanagementflag user, himself or services on behal...

braintree - Rails 4 : Active record collection looping or iteration -

in rails customer controller there active record collection object: 1. @pay_invoices = invoice.where(customer_id: @pay_cus_id) #<activerecord::relation [#<invoice id: 37, customer_id: 53, paid_amount: 960, devicemodel_id: 2, transaction_id: "6drv3s", created_at: "2016-01-04 05:29:03", updated_at: "2016-01-25 12:16:14">, #<invoice id: 70, customer_id: 53, paid_amount: 80, devicemodel_id: 2, transaction_id: "2mr93s", created_at: "2016-01-28 09:02:43", updated_at: "2016-01-28 09:02:43">]> also in controller using transaction_id: column value find out transaction details in braintree payment gateway using following braintree api call: @tid = @pay_invoices[0].transaction_id @transaction = braintree::transaction.find(@tid) this works fine me, transaction details of first transaction_id: @pay_invoices collection can retrieved using code, want iterate through @pay_invoices collection , each time ...

groovy - Java class for script parameters -

i'm working on java motor groovy. want make class can stock parameters needed execute groovy script. what best way stock parameters, thought make list of list contain "type", "name" , "value" think i'm on wrong way ? i searched haven't maybe basic.

ajax - React child component seems not to be rendered when parent state is updated? -

i have (probably stupid) question workflow in react did not yet understand. i have parent component fetches data server through ajax call. 1 of return values boolean passed child component property. child component again fetches data server (ajax) according property value. somehow parent component it's changes accordingly child not re-render? doing wrong? parent component: var l5fmmodal = react.createclass({ getinitialstate : function() { return { initrunswitch : false, data : [] }; }, componentdidmount: function() { this.loaditems('l5fm/setstate', null); }, loaditems : function(url, modalstate) { $.ajax({ url: url, contenttype: 'application/json; charset=utf-8', data: {modalstate : json.stringify(modalstate)}, datatype: 'json', cache: false, ...

c# - Is ist ok to throw a HttpException(401) in custom AuthorizeAttribute? -

i have custom authorizeattribute: public class myauthattribute:authorizeattribute { protected override bool authorizecore(httpcontextbase httpcontext) { return currentuser.roles.contains(this.roles); } } now return currentuser.roles works fine. if returns false, browser displays 401. but want add additional information roles asked for. instead of return throw exception myself: throw new httpexception(401,string.format("user should have been in 1 of following roles: {0}",this.roles); is ok throw 401-exception inside authorizeattribute instead of returning false? or there other (better) ways information browser? if going send 401 send normal 401 www-authenticate header (if aren't using form of authentication uses www-authenticate 401 inappropriate). if want give information in body of custom html response goes 401 (it shown if user cancels out of authentication prompt). for other case something, choosing not allow particular user so, use 40...

lazarus - How to apply multiple filters on TSQLQuery -

singular filter on column works, example: sqlquery.filter := 'columnname="some_filtered_text"'; // ok but how apply filter many columns? for example doesn't work: sqlquery.filter := 'columnname1="some_filtered_text1", columnname2="some_filtered_text2"'; // exception it raises exception: "tapplication.handleexception operator/function missing".