« first day (3174 days earlier)      last day (1760 days later) » 

7:00 PM
Yeah you should have one too
May help alleviate this sudden desire to nest things
 
user10864482
@SamuelWakeman did you changed the namespace after you moved the file? (might not apply hehe)
 
Proff Brian Cox will be on the TV in 1 hour, and I will be off to Neptune woot.
 
i think that was one problem good catch
@user23333 good catch
 
7:21 PM
hey guys so
im trying to link a page pretty simple i know but so i moved the folder inside
and when i did exten my model
i wanted to try linking by describing the file name like this
<a asp-page="@("./"+Model.Product[1].GetType()+"/Index")">
that feels prerty messy way to link something
but essentially I've filtered the products so they are already part of the same category at this point though the the products dont have a category collum
though they do have a desccriminator colum
which is actually the same thing
 
user10864482
I think you should try this Page.ResolveUrl
 
do i use that in an action as opposed to in the cshtml
i assume
 
user10864482
 
user10864482
because page.resolveurl is for regular asp.net
 
user10864482
i.e <link rel="stylesheet" href="@Url.Content("~/Content/style.css")" type="text/css" />
 
user10864482
7:28 PM
~ being a char that refer relative to your project
see for more ; https://stackoverflow.com/a/27237204/10864482
 
ok new issue
Model.Product.GetType() returns EisenNetwork.models.fastener
i just want it to return fastener
but that was a useful stack overflow link thank you
 
user10864482
it kind of bother me that your model fastener don't start with a upper case
 
user10864482
7:45 PM
@SamuelWakeman have a look at this stackoverflow.com/a/3396307/10864482
 
user10864482
TL;DR typeof(T).Name so GetType().Name instead
 
fastener is uppercase i was just typing fast for chat purposes thanks
@user23333 Works like a charm
 
builder.Metadata.FindNavigation(nameof(Basket.Items)); does this mean it check if a custom name mentioned for the property Items ?
 
user10864482
@Sakthivel not sure to understand your question
 
8:01 PM
nameof just converts the type name to string and returns.
 
user10864482
directly from microsoft

FindNavigation(String)
This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code.
https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.metadata.internal.entitytype.findnavigation?view=efcore-2.1
 
@user23333 FindNavigation(GetTypeOf(Basket.Items).ToString()) is it same as FindNavigation(nameof(Basket.Items));
 
user10864482
the same but not equals for the future
 
ah i get it !
thanks :)
 
8:21 PM
hey guys...
my boss wants a table like 10 + cols
which is fine
no one gives a shit
the table actually has like 30 cols because single table inheritance lmao
but lets ignore that for a sec
for every collum he wants an order by both ascending and desceding.
that ammounts to a switch with 20 caises... for one type of product...
 
are you using an ORM
 
object relational mapper
like entity framework
 
yes i am
 
well, let's step back here
what is your boss looking at that they want sorted
because if it's some kind of UI, you want to sort it there
you don't need or want to make a new database call every time someone wants the data sorted differently
 
user10864482
8:23 PM
datatable ftw
 
right
 
user10864482
a nice tut for datatable integration into a mvc project; c-sharpcorner.com/article/…
 
well while I was gonna do this similar to this
 
seems like whatever table you're using should have this built in
 
user10864482
yes but that's a bunch of switch
 
user10864482
8:25 PM
I like switch but darn
 
you'd think there'd be a table with this sort of thing built in
given that this is an extremely common thing to want to do
 
IQueryable<Product> SearchProducts (params string[] keywords)
{
  IQueryable<Product> query = dataContext.Products;

  foreach (string keyword in keywords)
  {
    string temp = keyword;
    query = query.Where (p => p.Description.Contains (temp));
  }
  return query;
}
 
If you want to do it in EF, you could get a little smarter with it
 
I found this example as why we need Predicates. but is it right ? won't query be reset on foreach iterations ?
 
no, because of how Linq works
doing query.Where() returns a special linq object that says "when someone enumerates me, do query, and then do the where clause on it"
and if you do a bunch, you can build up a bunch of these where clauses
This is kind of a weird way to do it, I wouldn't do it like that
at least get out of that weird temp = keyword thing
 
8:32 PM
oh, so the query maintains the list of products that were previously filtered. alright. I found it herehttp://www.albahari.com/nutshell/predicatebuilder.aspx
@Grace haha thanks
 
Also, this would get you products where the description has all the keywords
is that what you want
 
user10864482
@Grace why isn't that considered a front end thing?
 
well, if you're doing a store, you don't want to make the client download your entire product catalog
you want them to search your database
 
user10864482
@Grace no but I would assume there is some pagination
 
so, what, they get a page of... random, unfiltered products
and then see if any of them are what they want?
sql queries aren't really super suited for this, there's a reason there's such a thing as Azure Search and Elastic Search
 
user10864482
8:38 PM
@Grace no; get a page of result and order them using client resource.
 
I agree that you should do the sorting on the client side
well, it depends
if you have a small set of products, ordering on the client side is fine
but if you're on Amazon, changing the order makes them hit the database again
because of the pagination
 
user10864482
well the database will be hit no matter right?
 
you can sort a list on the client side without hitting the database
but the results will only be correct if the client has all the information it needs
 
user10864482
but you would because it wouldn't make sense not to implement pagination
 
depends on how many items you have
if my store sells twenty things, who cares
 
user10864482
8:42 PM
true
 
im probably going to pagination eventually
considering anticipated size
and number of products
 
8:56 PM
@Grace Yes, but i went writing Expression <Func<T>> and not IQueryable<T> with foreach. I was looking at how Expression differs from Func and ended up with that weird example
 
Expression is a Linqism, I think
 
@user23333 its more like, you search "Black shoes" and you must see shoes which are black. doesn't make sense if you see 10 more blue shirts with pagination.
@Grace Yes, that's why it pretty much used on .where(criteria) criteria is Expression. or list.Any(Expression). but i am not sure if the latter will work
 
9:16 PM
you could do something liiiike
Well, it'd be a bit more of a pain to do it with .Any
I don't know if you want "all of these words" semantics or "any of these words" semantics
If you wanted easier searching, you'd probably do well to have a separate key words table that you can join to
or, you know, use a big boy search framework like Azure Search
searching the description of every product like that is not gonna scale well
 
Hey Friends, anyone here use Microsoft Graph?
 
yes.
 
Does the oData Get Param "Skip" not working for /users?
$skip=5
I'm using ActiveDir for my user system, now that's it all hooked up and happy, some very essential oData commands don't appear to work when dealing with graph.microsoft.com/v1.0/users
that was /users
i want to allow the user to paginate through the users
i can use the skipToken, but that's only one direction
can't go back
and I can't get a user Count either.
 
so what do you do?
 
9:25 PM
If you want the user to be able to page backwards, you can store them
 
that's rough
 
you could use, like, an array
 
i know, just hard to share between users
my site is very much based off clicking share
 
wouldn't the users see different things anyways
because of how graph works
 
in certain cases i suppose
but i still want to share page 5 etc
 
9:27 PM
so linking to a certain page of results doesn't make sense anyways
 
ok, what about a count?
the users API doesn't allow $count
so do i need to iterate through all of them?
my system has 5000+ users...
that's like a solid 10 second wait time
on a good internet connection
 
sounds like you should rethink what you're doing, then
 
Active Directory was forced upon me
i have my own clean wonderful system
for authentication and users
my company wants to use AD for every aspect of auth
 
You have $top
 
yeah, you can get up to 1000 results
 
9:30 PM
and, I suspect, other ways to filter so you don't have to get the entire list of users
 
that was my goal, to not grab the entire user list
but to count them, it appears to be the only way
 
Ah, I see, can't count users
 
yeah :/
so odd that they would disable it there, seems like a common usage
 
so, what, you just want to know how many users you have
 
for my pagination
so you know how many results there are
i wanted to count, and use skip
 
9:35 PM
maybe you should want to do something else
 
I don't think i have a choice here :(
 
be flexible, believe in yourself
use the pagination api you have, not the one you don't
brain with your thinker
 
wish i could, we completely replaced my user system
gun to my head
 
how dare you want to use a standard api instead of one guy's project
I get it, it's your baby, and you're married to it
 
no! I'm more than willing to make the move! I just keep getting blind sided by abstract configurations and limitations of AD
 
9:49 PM
this seems like a pretty reasonable limitation to me
pagination is already pretty expensive to implement
letting people ask for just page 20 makes you do and then throw away a lot of work
 

« first day (3174 days earlier)      last day (1760 days later) »