داستان آبیدیک

underscore


فارسی

1 کامپیوتر و شبکه:: underscore

welcome back so now that we have our different methods here that are not implemented we need to start Implementing those methods now before we do that I want to kind of since we are now working with an internal thing right Here I'm going to make this guy private meaning that people from the outside cannot access our lists directly there we go and then I'll make this an Underscore because in the.net language when we have a private variable we normally make an underscore for it now this pretty much means that now I've encapsulated the list of customers on my Database of customers inside the customer repository so nobody can get it unless they go through my different Functions right here sweet so now we Have that available now how do we create a customer well if we go back to the Program and we have a look at how we Actually create a program a customer Here there's one called add customer right here the way we do it is pretty much just say add the customer right because here we have a list so that's very simple and then we add a new Customer and just add the three properties we have available right now and then we add an ID to the guy now that's a bit different in the new version we have right here because I want to be able to add a customer but I don't want people from the outside to set the ID because I have to be in Control of that so deciding what the ID should be that's something from me to decide in here ok so when I create a Customer I expect that the guy who sends in the customer to me he's actually going to have either no ID or something that I can override so I'm going to say the customers ID is going to be the new ID right here and then I'm just going to add to that ID right so now I have added So that the ID is 1 plus whatever customer I'm at right now in my system suite the next thing I want to do is kind of just say the customer needs to be added to my list so I can just add the customer right here customers start at and then I'll add the customer there we go now we've added the customer and the last thing I do is just return the customer again just to kind of uphold The contract from the repository the customer repository the interface right I have to return a customer in the end there we go so now that should be added and returned happy days sweet so that was a create function we return a list of all the customers That we have available pretty easy we'll just to returns them right here and say we want to return the Customers list so now you have all the customers available that you can use that them for something right how do we get a specific customer again if I jump Back and forth between the program they should be want on how to read a single customer somewhere yeah we go find Customer by ID something like this we Run over the list of customers and look for a specific one let's just grab that one just for now we're just going to do something as simple as that and say somebody's passing in an ID right here I'm going to run over my list of Customers and if I find the customer and he matches the ID I'm going to return that customer if not I'm going to return no right pretty much the same ideas we did in the UI to update a customer now this is a bit more tricky because I'm actually going to remove this from repository later so let me just add a note here so you guys know that it's going to be removed later remove later when we use unit of work oh yeah when That pops up we're going to remove this guy from the repository I'll explain that later but for now we need to be Able to update a customer how do we do that in the program so let's jump back to this file right here do we have an edit yeah we do so we first found the customer that we want to Edit and then we can just set the information on that customer we can do the same thing right here so let's just copy this guy over say we wanna in the repository read the customer so let's just make a local variable right here customer from DB equal notice the bee man I need a new B key I can say this Read write read by ID and then I can pass in the customer to updates ID right and then hopefully let me just give you guys some more space here so you can see what I'm actually typing there we go so now that we have the customer we can just do a null check if customer from DB is actually there not null then let's do Something but if he isn't and we'll just return right here no we didn't update the customer that's kind of the way that I want to explain that we did find him if that's not even all they would go so now we kind of have a customer from the database and now we Just want to update all the information so we'll say custom from database dot first-name equals the customer that we are sending in from the outsides first-name etcetera right let's just do that there we go now we have all the different properties we want to update whoops it's only a single equal sign and when we're done we'll just return the actual customer we just update it there we go so now that should pretty much be The same idea that we had inside the program right we get the customer from The database or from our customers list we update the customer and then we return them when we're done right so now he we have the returned customer and we Get in all if we somehow couldn't find the customer we could pop up saying cosmonaut found I don't know sweet the last one is to delete one and again let's jump back to the program and see how we handled that in the program delete customer we find him and then remove him from the customer list we can use this again so let's just try and do the same thing in our implementation in the repository there we go find a Customer by ID so and that's not quite he thing we're doing here we say Reap ID instead put in the ID that we want to read if the customer is found then we Take him and remove him from the list that we have locally there we go and now we've removed him and then in our case we want to kind of return null if we didn't find the customer all will return the customer that we just deleted I know this might be overkill but that's really up you how you want to do it so now we kind of made an implementation of the same information that we had in our Program but now when we're done next Lesson we're going to remove the domain Logic the service that kind of takes care of storing the data we're going to Remove that from the UI or the program into the domain service layer or inside the core combined with the Infrastructure okay so that's going to be the next lesson so see you next time we'll try and get rid of all domain-specific or infrastructure specific information in here ever my code now this give me a possibility of later on providing different types of repositories if I want to and we'll look into that later but for now just accept that what we're going to do is we're going to dependency inject the repository because we need it to work with our customer and stored the data inside a data source later so I'll do a new I repository I customer repository right here customer repository I just do a command dot and I'll use the domain service for that one and I'll make it just customer repository right here okay and then I'll do a private I'll just store this inside a private variable I just call it customer repo just to make a different name and notice the underscore in front right here is because it's going to be a private variable inside the class and that's going to be equal to customer repository right here there we go and I'm going to let the ID take care of actually creating this property for me by command clicking and creating field right here there we go and there we go now we have a private field and we don't even have to put in private because as default if you don't put in anything this guy will be private another thing I do is I can actually make it read-only because this is never going to change right so oh I need to put it in front of notice now I can just I don't have to worry about how this is actually created let's actually do an underscore right

واژگان شبکه مترجمین ایران

2 عمومی:: خط‌ یا علامتی‌ زیرچیزی‌ كشیدن‌، زیرین‌ خط‌، تاكید

شبکه مترجمین ایران

3 روان شناسی و مشاوره:: تأکید کردن

And in so doing, we began to underscore another important group axiom, which is that everything you want to know about other people's opinions of you, other people's feelings about you in this group, is available right here in this group. We went back and underscored that, again trying to give a great deal of support for this difficult exercise in which people were now engaging. And I think it's important to underscore, because there is a reluctance by lot of group therapists who are not used to working in this manner to work with the here-and-now, because they feel that invariably constitutes conflict; that we are going to get into conflict, going to get into negative feeling, which is not at all the case, because working in the here-and-now can also underscore and illuminate the positive feelings that people have toward one another.

واژگان شبکه مترجمین ایران


معنی‌های پیشنهادی کاربران

نام و نام خانوادگی
شماره تلفن همراه
متن معنی یا پیشنهاد شما
Captcha Code