Search Results

Search found 4565 results on 183 pages for 'nhibernate mapping'.

Page 71/183 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • How to create relationship mapping via Entity framework

    - by James
    I have following domain model: User { int Id; } City { int Id; } UserCity { int UserId, int CityId, dateTime StartDate } In the function where I have to attach a user to a city, the following code is working for me: UserCity uc = new UserCity(); //This is a db hit uc.User = MyEntityFrameworkDBContext.User.FirstOrDefault(u => u.ID == currentUserId); //this is a db hit uc.City = MyEntityFrameworkDBContext.City.FirstOrDefault(c => c.ID == currentCityId); uc.StartDate = userCityStartDate; //this is a db hit MyEntityFrameworkDBContext.SaveChanges(); Is there any way I can create relationships with just one single DB hit? The first two db hits are not required, actually.

    Read the article

  • Query for Joining Two Tables With Possible Multiple Mapping

    - by Dharmendra Mohapatra
    First_table srno wono Actual_Start_Date Actual_End_Date 1 31 2012-06-02 2012-06-05 2 32 2012-06-05 2012-06-22 3 33 2012-06-11 2012-06-23 4 34 2012-06-23 2012-06-30 5 A-2 2012-06-24 2012-06-25 6 BU 2012-06-24 2012-06-26 7 40 2012-06-25 2012-06-27 second_table srno wono Base_start_date Base_end_date uploadhistoryid 1 31 2012-06-05 2012-06-05 1 2 32 2012-06-11 2012-06-12 2 3 32 2012-06-15 2012-06-17 3 4 32 2012-06-18 2012-06-20 4 5 33 2012-06-22 2012-06-25 5 5 33 2012-06-23 2012-06-25 5 Result Required SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[Reports_Subanalysis] ( @WONo VARCHAR(20) ) AS BEGIN SELECT 'SAT' AS stage, s.Base_start_date AS start_date, s.Base_end_date AS end_date, f.Actual_Start_Date AS Actual_Start_Date, f.Actual_end_Date AS Actual_End_Date FROM First_table f, second_table B WHERE A.wOno=B.nOno AND f.uploadhistoryid in (SELECT min(uploadhistoryid) FROM second_table C WHERE f.wono = C.wono) AND b.wono=@WONo END when I pass '32' Result stage start_date end_date Actual_Start_Date Actual_End_Date SAT 2012-06-11 2012-06-12 2012-06-05 2012-06-05 how Can I get the result like this when I pass non matching value like 'BU' stage start_date end_date Actual_Start_Date Actual_End_Date SAT NULL NULL 2012-06-24 2012-06-26 What modification do I need in my routine?

    Read the article

  • Entity Framework one-to-one relationship mapping flattened in code

    - by Josh Close
    I have a table structure like so. Address: AddressId int not null primary key identity ...more columns AddressContinental: AddressId int not null primary key identity foreign key to pk of Address County State AddressInternational: AddressId int not null primary key identity foreign key to pk of Address ProvinceRegion I don't have control over schema, this is just the way it is. Now, what I want to do is have a single Address object. public class Address { public int AddressId { get; set; } public County County { get; set; } public State State { get; set } public ProvinceRegion { get; set; } } I want to have EF pull it out of the database as a single entity. When saving, I want to save the single entity and have EF know to split it into the three tables. How would I map this in EF 4.1 Code First? I've been searching around and haven't found anything that meets my case yet. UPDATE An address record will have a record in Address and one in either AddressContinental or AddressInternational, but not both.

    Read the article

  • Mapping over multiple Seq in Scala

    - by bsdfish
    Suppose I have val foo : Seq[Double] = ... val bar : Seq[Double] = ... and I wish to produce a seq where the baz(i) = foo(i) + bar(i). One way I can think of to do this is val baz : Seq[Double] = (foo.toList zip bar.toList) map ((f: Double, b : Double) => f+b) However, this feels both ugly and inefficient -- I have to convert both seqs to lists (which explodes with lazy lists), create this temporary list of tuples, only to map over it and let it be GCed. Maybe streams solve the lazy problem, but in any case, this feels like unnecessarily ugly. In lisp, the map function would map over multiple sequences. I would write (mapcar (lambda (f b) (+ f b)) foo bar) And no temporary lists would get created anywhere. Is there a map-over-multiple-lists function in Scala, or is zip combined with destructuring really the 'right' way to do this?

    Read the article

  • Mapping the System.Exception with FaultException

    - by user357342
    I have used exception sheilding feature of application block, to map System.Exception with class that is marked as DataContract. It works very well. But When I have mapped the System.Exception with FaultException, I got the below error message. "An error has occurred while consuming this service. Please contact your administrator for more information. Error ID: fe2d28b5-8d26-430e-baf4-fe4b39da853c" Please let me know whether I can map the System.Exception with FaultException

    Read the article

  • Efficient mapping of game entity positions in Java

    - by byte
    In Java (Swing), say I've got a 2D game where I have various types of entities on the screen, such as a player, bad guys, powerups, etc. When the player moves across the screen, in order to do efficient checking of what is in the immediate vicinity of the player, I would think I'd want indexed access to the things that are near the character based on their position. For example, if player 'P' steps onto element 'E' in the following example... | | | | | | | | | |P| | | | |E| | | | | | | | | ... would be to do something like: if(player.getPosition().x == entity.getPosition().x && entity.getPosition.y == thing.getPosition().y) { //do something } And thats fine, but that implies that the entities hold their positions, and therefor if I had MANY entities on the screen I would have to loop through all possible entities available and check each ones position against the player position. This seems really inefficient especially if you start getting tons of entities. So, I would suspect I'd want some sort of map like Map<Point, Entity> map = new HashMap<Point, Entity>(); And store my point information there, so that I could access these entities in constant time. The only problem with that approach is that, if I want to move an entity to a different point on the screen, I'd have to search through the values of the HashMap for the entity I want to move (inefficient since I dont know its Point position ahead of time), and then once I've found it remove it from the HashMap, and re-insert it with the new position information. Any suggestions or advice on what sort of data structure / storage format I ought to be using here in order to have efficient access to Entities based on their position, as well as Position's based on the Entity?

    Read the article

  • numpy array mapping and take average

    - by user566653
    Dear all, I have three array value = np.array ([1, 3, 3, 5, 5, 7, 3]) index = np.array ([1, 1, 3, 3, 6, 6, 6]) data = np.array ([1, 2, 3, 4, 5, 6]) and want to take average for item of "value" by array "index", and assign a new array with value of "data", such as [2, nan, 4, nan, nan, 5] first value is the average of 1st and 2nd of "value" second value is nan because there is not any key in "index" third value is the average of 3rd and 4th of "value" ... Thanks for your help!!! Regards, Roy

    Read the article

  • Perl and hosts file mapping question?

    - by user275633
    All, I have a hosts file that looks like this: 10.10.10.1 myserver1 myserver1alias 10.10.10.2 myserver2 myserver2alias I'm looking for a way using perl to pass in an argument of myserver1 and have it return myserver1alias, likewise if I pass in myserver2 it should return myserver2alias. Any suggestions?

    Read the article

  • Hibernate List<Enum> mapping

    - by Ranna
    I have a bean property Map<Long,List<TransactionFlowEnum>> accessRights. Please help me out to map it in hbm file. I have tried by following but it is not working out. <map name="accessRights" cascade="refresh" table="privilege_access_right_map"> <key column="privilege_id"/> <map-key column="document_type_id" type ="long"/> <many-to-many class="com.v4common.shared.beans.usermanagement.TransactionFlowEnum" column="access_right_id" /> </map> Thanks In Advance.

    Read the article

  • Database/Object Mapping

    - by Eric
    Hello everyone, This is a beginner question, but it's been frustrating me... I am using C#, by the way. I'd like to make a few classes, each with their own properties and methods. I would also like to have a database to store certain instances of these classes in case I would ever need to look at them again. So, for example... class Polygon { String name; Double perimiter; int numSides; public Double GetArea() { // ... } } class Circle { String name; Double radius; public void PrintName() { // ... } } Say I've got these classes. I also want a database that has the TABLES "Polygon" and "Circle" with the COLUMNS "name" "perimeter" "radius" etc. And I want an easy way to save a class instance into the database, or pull a class instance out of the database. I have previously been using MS Access for my database stuff, which I don't mind using, but I would prefer if nothing other than .NET need to be installed. I've been researching online a bit, but I wanted to get some opinions on here. I have looked at Linq-to-Sql, but it seems you need Sql-Server. Is this true? If so, I'd really rather not use it because I don't want to have to have it installed everywhere. Anway, I'm just fishing for some ideas/insights/suggestions/etc. so please help me out if you can. Thanks.

    Read the article

  • Multi valued profile property mapping to AD in Sharepoint

    - by keeno
    I'm trying to map my skills and responsibilities profile sections to one of the custom properties in Active Directory (extensionattribute1 , 2, etc). I'm entering comma seperated values in AD and it's importing the values fine but sees the comma seperated values as one value on import. i.e. 'C#,asp.net,javascript' rather than 'C#', 'asp.net', 'Javascript'. Any ideas. I'm almost there it's just not spliting the values correctly on import. thanks in Advance

    Read the article

  • Best Design Pattern to Implement while Mapping Actions in MVC

    - by FidEliO
    What could be the best practices of writing the following case: We have a controller which based on what paths users take, take different actions. For example: if user chooses the path /path1/hello it will say hello. If a user chooses /path1/bye?name="Philipp" it will invoke sayGoodBye() and etc. I have written a switch statement inside the controller which is simple, however IMO not efficient. What are the best way to implement this, considering that paths are generally String. private void takeAction() { switch (path[1]) { case "hello": //sayHello(); break; case "bye": //sayBye(); break; case "case3": //Blah(); break; ... } }

    Read the article

  • OpenGL Mapping Textures to a Grid Stored Inside Vertex Array

    - by Matthew Hoggan
    I am writing a test to verify something. This is not production code, just verification code. So I would appreciate it if the specific question was answered. I have code that uses indices and vertices to draw a set of triangles in the shape of a grid. All the vertices are drawn using glDrawElements(). Now for each vertex I will set its corresponding Texture Coordinates to 0 or 1 for each set of triangles that form a square in the grid. Basically I want to draw a collage of random textures in each one of the "squares" (consisting of two triangles). I can do this using the glBegin() and glEnd() method calls inside a for loop using the fixed functional pipeline, but I would like to know how to do this using Vertex Arrays.

    Read the article

  • Tool to maintain a Data Mapping between two systems

    - by ktaylorjohn
    We have XML interfaces between multiple systems. An Enterprise Domain Model is missing in the overall architecture, hence the terms Product/Customer/User means different things to different systems. We currently use excel sheets to map the elements in incoming XML to what the actual Field means within our system. Additionally, it contains the values of Mandatory/Optional and length of each field. We call this the Data Dictionary. Any changes to the XML go through rounds of deliberation and updates to Word and Excel documents. Is there a better way to do this? Any tool/GUI based approach which all systems and owners can view?

    Read the article

  • Mapping restful ajax requests to spring

    - by Diones
    I have this piece of code: @RequestMapping(value = "/test.json", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody Object[] generateFile(@RequestParam String tipo) { Object[] variaveis = Variavel.getListVariavelByTipo(tipo); return variaveis; } As far as I know it should take a request to test.json?tipo=H and return the JSON representation of Variavel[], however when I make such request I get: HTTP Status 406 - type Status report message descriptionThe resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers () By using the following function I can get the expected json: @RequestMapping(value = "/teste.json") public void testeJson(Model model, @RequestParam String tipo) { model.addAttribute("data", Variavel.getListVariavelByTipo("H")); } What I'm doing wrong?

    Read the article

  • Mapping a URL to a service inside a class library

    - by johnk82swe
    I'm developing a small content management solution than can be used in any ASP.NET 3.5 website. The website references some dll's and then lets the aspx's inherit my page baseclass. Some configuration in web.config is also needed, but thats it. Now I'm building a standalone Silverlight editor for the CMS. My idea is that it should communicate with the server using web services. But the question is how to make this service available to the editor? I don't want the website developers having to bother with it. If I used a REST API rather than SOAP I could just create an HttpHandler in my class library and let the website developers add a handler to it in web.config with the path "editor" and then the editor could communicate with that handler on mywebsite.com/editor. Is there any way to achieve the same with a asmx or wcf service? The important thing is that the website developers never have to set up any asmx files or anything. They should only have to specify a url and map that url to a service inside my class library. Thanks in advance!

    Read the article

  • Struts2 form to action fields mapping automatically

    - by hkansal
    Hello, I would like to know if it is possible, in Struts2, to map an HTML form's fields to those of an action, automatically, without getters and setters. It is clear that by getters and setters or the ParameterAware interface and the Map, fields can be set in the action, but I just wanted to know if otherwise there was a way.

    Read the article

  • Hibernate Relationship Mapping/Speed up batch inserts

    - by manyxcxi
    I have 5 MySQL InnoDB tables: Test,InputInvoice,InputLine,OutputInvoice,OutputLine and each is mapped and functioning in Hibernate. I have played with using StatelessSession/Session, and JDBC batch size. I have removed any generator classes to let MySQL handle the id generation- but it is still performing quite slow. Each of those tables is represented in a java class, and mapped in hibernate accordingly. Currently when it comes time to write the data out, I loop through the objects and do a session.save(Object) or session.insert(Object) if I'm using StatelessSession. I also do a flush and clear (when using Session) when my line count reaches the max jdbc batch size (50). Would it be faster if I had these in a 'parent' class that held the objects and did a session.save(master) instead of each one? If I had them in a master/container class, how would I map that in hibernate to reflect the relationship? The container class wouldn't actually be a table of it's own, but a relationship all based on two indexes run_id (int) and line (int). Another direction would be: How do I get Hibernate to do a multi-row insert?

    Read the article

  • Hadoop: Mapping binary files

    - by restrictedinfinity
    Typically in a the input file is capable of being partially read and processed by Mapper function (as in text files). Is there anything that can be done to handle binaries (say images, serialized objects) which would require all the blocks to be on same host, before the processing can start.

    Read the article

  • Using query to change table mapping

    - by crapbag
    I have a table mytable( id, key, value). I realize that key is generating a lot of data redundancy since my key is a string. (my keys are really long, but repetititve) How do I build a separate table out that has (key, keyID) and then alternate my table to be mytable( id, keyID, value) and keyTable(keyID, key) ?

    Read the article

  • Suggestions on how to map from Domain (ORM) objects to Data Transfer Objects (DTO)

    - by FryHard
    The current system that I am working on makes use of Castle Activerecord to provide ORM (Object Relational Mapping) between the Domain objects and the database. This is all well and good and at most times actually works well! The problem comes about with Castle Activerecords support for asynchronous execution, well, more specifically the SessionScope that manages the session that objects belong to. Long story short, bad stuff happens! We are therefore looking for a way to easily convert (think automagically) from the Domain objects (who know that a DB exists and care) to the DTO object (who know nothing about the DB and care not for sessions, mapping attributes or all thing ORM). Does anyone have suggestions on doing this. For the start I am looking for a basic One to One mapping of object. Domain object Person will be mapped to say PersonDTO. I do not want to do this manually since it is a waste. Obviously reflection comes to mind, but I am hoping with some of the better IT knowledge floating around this site that "cooler" will be suggested. Oh, I am working in C#, the ORM objects as said before a mapped with Castle ActiveRecord. Example code: By @ajmastrean's request I have linked to an example that I have (badly) mocked together. The example has a capture form, capture form controller, domain objects, activerecord repository and an async helper. It is slightly big (3MB) because I included the ActiveRecored dll's needed to get it running. You will need to create a database called ActiveRecordAsync on your local machine or just change the .config file. Basic details of example: The Capture Form The capture form has a reference to the contoller private CompanyCaptureController MyController { get; set; } On initialise of the form it calls MyController.Load() private void InitForm () { MyController = new CompanyCaptureController(this); MyController.Load(); } This will return back to a method called LoadComplete() public void LoadCompleted (Company loadCompany) { _context.Post(delegate { CurrentItem = loadCompany; bindingSource.DataSource = CurrentItem; bindingSource.ResetCurrentItem(); //TOTO: This line will thow the exception since the session scope used to fetch loadCompany is now gone. grdEmployees.DataSource = loadCompany.Employees; }, null); } } this is where the "bad stuff" occurs, since we are using the child list of Company that is set as Lazy load. The Controller The controller has a Load method that was called from the form, it then calls the Asyc helper to asynchronously call the LoadCompany method and then return to the Capture form's LoadComplete method. public void Load () { new AsyncListLoad<Company>().BeginLoad(LoadCompany, Form.LoadCompleted); } The LoadCompany() method simply makes use of the Repository to find a know company. public Company LoadCompany() { return ActiveRecordRepository<Company>.Find(Setup.company.Identifier); } The rest of the example is rather generic, it has two domain classes which inherit from a base class, a setup file to instert some data and the repository to provide the ActiveRecordMediator abilities.

    Read the article

  • CQRS - The query side

    - by mattcodes
    A lot of the blogsphere articles related to CQRS (command query repsonsibility) seperation seem to imply that all screens/viewmodels are flat. e.g. Name, Age, Location Of Birth etc.. and thus the suggestion that implementation wise we stick them into fast read source etc.. single table per view mySQL etc.. and pull them out with something like primitive SqlDataReader, kick that nasty nhibernate ORM etc.. However, whilst I agree that domain models dont mapped well to most screens, many of the screens that I work with are more dimensional, and Im sure this is pretty common in LOB apps. So my question is how are people handling screen where by for example it displays a summary of customer details and then a list of their orders with a [more detail] link etc.... I thought about keeping with the straight forward SQL query to the Query Database breaking off the outer join so can build a suitable ViewModel to View but it seems like overkill? Alternatively (this is starting to feel yuck) in CustomerSummaryView table have a text/big (whatever the type is in your DB) column called Orders, and the columns for the Order summary screen grid are seperated by , and rows by |. Even with XML datatype it still feeel dirty. Any thoughts on an optimal practice?

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >