Search Results

Search found 9916 results on 397 pages for 'entity component'.

Page 52/397 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Creating an ASP.NET report using Visual Studio 2010 - Part 1

    - by rajbk
    This tutorial walks you through creating an report based on the Northwind sample database. You will add a client report definition file (RDLC), create a dataset for the RDLC, define queries using LINQ to Entities, design the report and add a ReportViewer web control to render the report in a ASP.NET web page. The report will have a chart control. Different results will be generated by changing filter criteria. At the end of the walkthrough, you should have a UI like the following.  From the UI below, a user is able to view the product list and can see a chart with the sum of Unit price for a given category. They can filter by Category and Supplier. The drop downs will auto post back when the selection is changed.  This demo uses Visual Studio 2010 RTM. This post is split into three parts. The last part has the sample code attached. Creating an ASP.NET report using Visual Studio 2010 - Part 2 Creating an ASP.NET report using Visual Studio 2010 - Part 3   Lets start by creating a new ASP.NET empty web application called “NorthwindReports” Creating the Data Access Layer (DAL) Add a web form called index.aspx to the root directory. You do this by right clicking on the NorthwindReports web project and selecting “Add item..” . Create a folder called “DAL”. We will store all our data access methods and any data transfer objects in here.   Right click on the DAL folder and add a ADO.NET Entity data model called Northwind. Select “Generate from database” and click Next. Create a connection to your database containing the Northwind sample database and click Next.   From the table list, select Categories, Products and Suppliers and click next. Our Entity data model gets created and looks like this:    Adding data transfer objects Right click on the DAL folder and add a ProductViewModel. Add the following code. This class contains properties we need to render our report. public class ProductViewModel { public int? ProductID { get; set; } public string ProductName { get; set; } public System.Nullable<decimal> UnitPrice { get; set; } public string CategoryName { get; set; } public int? CategoryID { get; set; } public int? SupplierID { get; set; } public bool Discontinued { get; set; } } Add a SupplierViewModel class. This will be used to render the supplier DropDownlist. public class SupplierViewModel { public string CompanyName { get; set; } public int SupplierID { get; set; } } Add a CategoryViewModel class. public class CategoryViewModel { public string CategoryName { get; set; } public int CategoryID { get; set; } } Create an IProductRepository interface. This will contain the signatures of all the methods we need when accessing the entity model.  This step is not needed but follows the repository pattern. interface IProductRepository { IQueryable<Product> GetProducts(); IQueryable<ProductViewModel> GetProductsProjected(int? supplierID, int? categoryID); IQueryable<SupplierViewModel> GetSuppliers(); IQueryable<CategoryViewModel> GetCategories(); } Create a ProductRepository class that implements the IProductReposity above. The methods available in this class are as follows: GetProducts – returns an IQueryable of all products. GetProductsProjected – returns an IQueryable of ProductViewModel. The method filters all the products based on SupplierId and CategoryId if any. It then projects the result into the ProductViewModel. GetSuppliers() – returns an IQueryable of all suppliers projected into a SupplierViewModel GetCategories() – returns an IQueryable of all categories projected into a CategoryViewModel  public class ProductRepository : IProductRepository { /// <summary> /// IQueryable of all Products /// </summary> /// <returns></returns> public IQueryable<Product> GetProducts() { var dataContext = new NorthwindEntities(); var products = from p in dataContext.Products select p; return products; }   /// <summary> /// IQueryable of Projects projected /// into the ProductViewModel class /// </summary> /// <returns></returns> public IQueryable<ProductViewModel> GetProductsProjected(int? supplierID, int? categoryID) { var projectedProducts = from p in GetProducts() select new ProductViewModel { ProductID = p.ProductID, ProductName = p.ProductName, UnitPrice = p.UnitPrice, CategoryName = p.Category.CategoryName, CategoryID = p.CategoryID, SupplierID = p.SupplierID, Discontinued = p.Discontinued }; // Filter on SupplierID if (supplierID.HasValue) { projectedProducts = projectedProducts.Where(a => a.SupplierID == supplierID); }   // Filter on CategoryID if (categoryID.HasValue) { projectedProducts = projectedProducts.Where(a => a.CategoryID == categoryID); }   return projectedProducts; }     public IQueryable<SupplierViewModel> GetSuppliers() { var dataContext = new NorthwindEntities(); var suppliers = from s in dataContext.Suppliers select new SupplierViewModel { SupplierID = s.SupplierID, CompanyName = s.CompanyName }; return suppliers; }   public IQueryable<CategoryViewModel> GetCategories() { var dataContext = new NorthwindEntities(); var categories = from c in dataContext.Categories select new CategoryViewModel { CategoryID = c.CategoryID, CategoryName = c.CategoryName }; return categories; } } Your solution explorer should look like the following. Build your project and make sure you don’t get any errors. In the next part, we will see how to create the client report definition file using the Report Wizard.   Creating an ASP.NET report using Visual Studio 2010 - Part 2

    Read the article

  • Tracking changes in Entity Framework 4.0 using POCO Dynamic Proxies across multiple data contexts.

    - by Rob Packwood
    I started messing with EF 4.0 because I am curious about the POCO possibilities... I wanted to simulate disconnected web environment and wrote the following code to simulate this: Save a test object in the database. Retrieve the test object Dispose of the DataContext associated with the test object I used to retrieve it Update the test object Create a new data context and persist the changes on the test object that are automatically tracked within the DynamicProxy generated against my POCO object. The problem is that when I call dataContext.SaveChanges in the Test method above, the updates are not applied. The testStore entity shows a status of "Modified" when I check its EntityStateTracker, but it is no longer modified when I view it within the new dataContext's Stores property. I would have thought that calling the Attach method on the new dataContext would also bring the object's "Modified" state over, but that appears to not be the case. Is there something I am missing? I am definitely working with self-tracking POCOs using DynamicProxies. private static void SaveTestStore(string storeName = "TestStore") { using (var context = new DataContext()) { Store newStore = context.Stores.CreateObject(); newStore.Name = storeName; context.Stores.AddObject(newStore); context.SaveChanges(); } } private static Store GetStore(string storeName = "TestStore") { using (var context = new DataContext()) { return (from store in context.Stores where store.Name == storeName select store).SingleOrDefault(); } } [Test] public void Test_Store_Update_Using_Different_DataContext() { SaveTestStore(); Store testStore = GetStore(); testStore.Name = "Updated"; using (var dataContext = new DataContext()) { dataContext.Stores.Attach(testStore); dataContext.SaveChanges(SaveOptions.DetectChangesBeforeSave); } Store updatedStore = GetStore("Updated"); Assert.IsNotNull(updatedStore); }

    Read the article

  • EFMVC Migrated to .NET 4.5, Visual Studio 2012, ASP.NET MVC 4 and EF 5 Code First

    - by shiju
    I have just migrated my EFMVC app from .NET 4.0 and ASP.NET MVC 4 RC to .NET 4.5, ASP.NET MVC 4 RTM and Entity Framework 5 Code First. In this release, the EFMVC solution is built with Visual Studio 2012 RTM. The migration process was very smooth and did not made any major changes other than adding simple unit tests with NUnit and Moq. I will add more unit tests on later and will also modify the existing solution. Source Code You can download the source code from http://efmvc.codeplex.com/

    Read the article

  • Is it possible to store ObjectContext on the client when using WCF and Entity Framework?

    - by Sergey
    Hello, I have a WCF service which performs CRUD operation on my data model: Add, Get, Update and Delete. And I'm using Entity Framework for my data model. On the other side there is a client application which calls methods of the WCF service. For example I have a Customer class: [DataContract] public class Customer { public Guid CustomerId {get; set;} public string CustomerName {get; set;} } and WCF service defines this method: public void AddCustomer(Customer c) { MyEntities _entities = new MyEntities(); _entities.AddToCustomers(c); _entities.SaveChanges(); } and the client application passes objects to the WCF service: var customer = new Customer(){CustomerId = Guid.NewGuid, CustomerName="SomeName"}; MyService svc = new MyService(); svc.Add(customer); // or svc.Update(customer) for example But when I need to pass a great amount of objects to the WCF it could be a perfomance issue because of I need to create ObjectContext each time when I'm doing Add(), Update(), Get() or Delete(). What I'm thinking on is to keep ObjectContext on the client and pass ObjectContext to the wcf methods as additional parameter. Is it possible to create and keep ObjectContext on the client and don't recreate it for each operation? If it is not, how could speed up the passing of huge amount of data to the wcf service? Sergey

    Read the article

  • How do I add ROW_NUMBER to a LINQ query or Entity?

    - by Whozumommy
    I'm stumped by this easy data problem. I'm using the Entity framework and have a database of products. My results page returns a paginated list of these products. Right now my results are ordered by the number of sales of each product, so my code looks like this: return Products.OrderByDescending(u => u.Sales.Count()); This returns an IQueryable dataset of my entities, sorted by the number of sales. I want my results page to show the rank of each product (in the dataset). My results should look like this: Page #1 1. Bananas 2. Apples 3. Coffee Page #2 4. Cookies 5. Ice Cream 6. Lettuce I'm expecting that I just want to add a column in my results using the SQL ROW_NUMBER variable...but I don't know how to add this column to my results datatable. My resulting page does contain a foreach loop, but since I'm using a paginated set I'm guessing using that number to fake a ranking number would NOT be the best approach. So my question is, how do I add a ROW_NUMBER column to my query results in this case?

    Read the article

  • What is the best way in assigning foreign key when using entity framework & LINQ to Entities?

    - by Abdel Olakara
    Hi all, I need to know the best practice of creating an entity object and assigning the foreign key. Here is my scenario. I have a Product table with pid,name,unit_price etc.. I also have a Rating table with pid (foregin key),rate,votes etc... Currently i am doing the following to create the rating object: var prod = entities.Product.First(p => p.product_id == pid); prod.Rating.Load(); if (prod.Rating != null) { log.Info("Rating already exists!"); // set values and Calcuate the score } else { log.Info("New Rating!!!"); Rating rating = new Rating(); // set values and do inital calculation prod.Rating = rating; } entities.SaveChanges(); Even though this works fine, i would like to know the best practice in doing these kind of assignment. Thanks for your suggestions and info. Best Regards, Abdel Olakara

    Read the article

  • How can I efficiently update only the entities that matter in a given frame?

    - by lezebulon
    I'm making a RTS, which can potentially have lots of units in one map (think Age of Empires). I'm looking for a way to update my units. I want to avoid calling a virtual Update() method every frame on every entity. On the other hand, units that are not in view should still be updated and behave "normally." I'm assuming this is a fairly standard question; what would be a way to handle this situation?

    Read the article

  • Why does the entity framework need an ICollection for lazy loading?

    - by Akk
    I want to write a rich domain class such as public class Product { public IEnumerable<Photo> Photos {get; private set;} public void AddPhoto(){...} public void RemovePhoto(){...} } But the entity framework (V4 code first approach) requires an ICollection type for lazy loading! The above code no longer works as designed since clients can bypass the AddPhoto / RemovePhoto method and directly call the add method on ICollection. This is not good. public class Product { public ICollection<Photo> Photos {get; private set;} //Bad public void AddPhoto(){...} public void RemovePhoto(){...} } It's getting really frustrating trying to implement DDD with the EF4. Why did they choose the ICollection for lazy loading? How can i overcome this? Does NHibernate offer me a better DDD experience?

    Read the article

  • How do you make use of the provider independency in the Entity Framework?

    - by Anders Svensson
    I'm trying to learn more about data access and the Entity Framework. My goal is to have a "provider independent" data access layer (to be able to switch easily e.g. from SQL Server to MySQL or vice versa), and since the EF is supposed to be provider independent it seems like a good way to go. But how do you use this provider independence? I mean, I was expecting to be able to sort of "program to an interface", and then just be able to switch database provider. But as far as I can tell I'm only getting a concrete type to program against, an "Entities" class, e.g. in my case it is: UserDBEntities _context = new UserDBEntities(); What I would have expected to be able to switch provider easily was to have an interface e.g. like IEntities _context = new UserDBEntities(); Sort of like I can do with datasets... But maybe that isn't how it works at all with EF? Or do you just switch provider in the connectionstring, and the model stays the same?? Please remember that I'm a complete newbie at this EF, and rather inexperienced with databases in general, so I would really appreciate if you could be as clear as possible :-)

    Read the article

  • Trying to edit an entity with data from dropdowns in MVC...

    - by user598352
    Hello! I'm having trouble getting my head around sending multiple models to a view in mvc. My problem is the following. Using EF4 I have a table with attributes organised by category. Couldn't post an image :-( [Have a table called attributes (AttributeTitle, AttributeName, CategoryID) connected to a table called Category (CategoryTitle).] What I want to do is be able to edit an attribute entity and have a dropdown of categories to choose from. I tried to make a custom viewmodel public class AttributeViewModel { public AttributeViewModel() { } public Attribute Attribute { get; set; } public IQueryable<Category> AllCategories { get; set; } } But it just ended up being a mess. <div class="editor-field"> <%: Html.DropDownList("Category", new SelectList((IEnumerable)Model.AllCategories, "CategoryID", "CategoryName")) %> </div> I was getting it back to the controller... [HttpPost] public ActionResult Edit(int AttributeID, FormCollection formcollection) { var _attribute = ProfileDB.GetAttribute(AttributeID); int _selcategory = Convert.ToInt32(formcollection["Category"]); _attribute.CategoryID = (int)_selcategory; try { UpdateModel(_attribute); (<---Error here) ProfileDB.SaveChanges(); return RedirectToAction("Index"); } catch (Exception e) { return View(_attribute); } } I've debugged the code and my _attribute looks correct and _attribute.CategoryID = (int)_selcategory updates the model, but then I get the error. Somewhere here I thought that there should be a cleaner way to do this, and that if I could only send two models to the view instead of having to make a custom viewmodel. To sum it up: I want to edit my attribute and have a dropdown of all of the available categories. Any help much appreciated!

    Read the article

  • Accessing both stored procedure output parameters AND the result set in Entity Framework?

    - by MS.
    Is there any way of accessing both a result set and output parameters from a stored procedure added in as a function import in an Entity Framework model? I am finding that if I set the return type to "None" such that the designer generated code ends up calling base.ExecuteFunction(...) that I can access the output parameters fine after calling the function (but of course not the result set). Conversely if I set the return type in the designer to a collection of complex types then the designer generated code calls base.ExecuteFunction<T>(...) and the result set is returned as ObjectResult<T> but then the value property for the ObjectParameter instances is NULL rather than containing the proper value that I can see being passed back in Profiler. I speculate the second method is perhaps calling a DataReader and not closing it. Is this a known issue? Any work arounds or alternative approaches? Edit My code currently looks like public IEnumerable<FooBar> GetFooBars( int? param1, string param2, DateTime from, DateTime to, out DateTime? createdDate, out DateTime? deletedDate) { var createdDateParam = new ObjectParameter("CreatedDate", typeof(DateTime)); var deletedDateParam = new ObjectParameter("DeletedDate", typeof(DateTime)); var fooBars = MyContext.GetFooBars(param1, param2, from, to, createdDateParam, deletedDateParam); createdDate = (DateTime?)(createdDateParam.Value == DBNull.Value ? null : createdDateParam.Value); deletedDate = (DateTime?)(deletedDateParam.Value == DBNull.Value ? null : deletedDateParam.Value); return fooBars; }

    Read the article

  • What to set the scalar type to contain a byte []. Entity in MVC2

    - by Brad8118
    I'm trying out the EF 4.0 and using the Model first approach. I'd like to store images into the database and I'm not sure of the best type for the scalar in the entity. I currently have it(the image scalar type) setup as a binary. From what I have been reading the best way to store the image in the db is a byte[]. So I'm assuming that binary is the way to go. If there is a better way I'd switch. In my controller I have: //file from client to store in the db HttpPostedFileBase file = Request.Files[inputTagName]; if (file.ContentLength > 0) { keyToAdd.Image = new byte[file.ContentLength]; file.InputStream.Write(keyToAdd.Image, 0, file.ContentLength); } This builds fine but when I run it I get an exception writing the stream to keyToAdd.Image. The exception is something like: Method does not exist. Any ideas? Note that when using a EF 4.0 model first approach I only have int16, int32, double, string, decimal, binary, byte, DateTime, Double, Single, and SByte as available types. Thanks

    Read the article

  • Why newly created entity object with navigation property is automaticly added to ObjectContext?

    - by Levelbit
    I have to entities: Company and Location (one to many). When I create new Location entity object and assign navigation property(Company) with the navigation property of already existing Location object (Location _new = new Location(); _new.Company = _old.Company). It seems that at that point newly created object is added to Object Context automatically, because when I call SaveChanges method that object is insert to database although I didn't call ObjectContext.AddObject(_new). I'm new in EF so there is probably reason why I have result like this? Is there need to assign also CompanyReference filed too and how to do it? IDaoFactory daoFactory = new DaoFactory(); ILocationDao locaitonDao = daoFactory.GetLocationDao(); IEnumerable<Location> locations = locaitonDao.GetLocations(); Location _old = locations.First(); Location _new = new Location(); _new.LocationName = _old.LocationName; _new.Company = _old.Company;// 1 _new.Address = _old.Address; //... ContactEntities.SaveChanges();//2 If I execute line (1) instantly _new object is added to object context and I can see additional datarow in my datagrid after line (2) is executed.

    Read the article

  • Domain Driven Design And The Entity Framework

    - by Hossein
    hi, I'm new to DDD and i want to use entity framework v4.0 (shipped with .net 4.0) in my new project. since i have few time to learn DDD and entity framework, which books are good for me to read first?! i'm going to first read Domain-Driven Design Tackling Complexity in the Heart of Software by Eric Evan and next Pro Entity Framework 4.0 (Apress Scott Klein)... the problem here is Eric Evan's book is too abstract,I want to know if the Pro Entity framework 4.0 is complete enough i just skip the first book! in the end recommend me some good books in DDD and Entity Framework Thanks

    Read the article

  • Spring/Hibernate: InvocationTargetException when deleting entity

    - by niklassaers
    I'm sorry if this question is a bit vague, but I'm quite confused. I've got a controller that calls a service to delete an entity and then create an entity in its place. In the service, I've got my DAO, and my entity, and I want to delete my entity, so I call DAO.delete(entity); Then, seemingly out of nowhere, I get an InvocationTargetException. The parameters here are: method: public org.springframework.web.servlet.ModelAndView tld.myproject.view.web.controller.MyController.replaceEntity(org.springframework.web.multipart.MultipartFile,javax.servlet.http.HttpServletRequest) target: tld.myproject.view.web.controller.MyController@185918e args: [org.springframework.web.multipart.commons.CommonsMultipartFile@14812a6, org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest@c08a64] ex: java.lang.reflect.InvocationTargetException private Object doInvokeMethod(Method method, Object target, Object[] args) throws Exception { ReflectionUtils.makeAccessible(method); try { return method.invoke(target, args); } catch (InvocationTargetException ex) { ReflectionUtils.rethrowException(ex.getTargetException()); } throw new IllegalStateException("Should never get here"); } Does anyone have a suggestion to what's going on? Anything I can use in my debugging? Cheers Nik

    Read the article

  • How to persist every new entity?

    - by simpatico
    I expect every instantiated entity to correspond to a tuple (& co) in the database. In the examples I see around, one always instantiates the entity (via a constructor) and then calls persist with that entity. I find this error-prone, and was wondering if it wasn't possible to have every instantiated entity automatically managed/persisted/reflected to the database (at least intended to). This also seems to prevent me from persisting instance variable entities. I.e. I've an entity which instantiates another (entities it has an association with) in its constructor.

    Read the article

  • Sysprep and Capture task sequence failing using MDT 2010

    - by Nic Young
    I have created a Windows Deployment Services server in Windows 2008 R2. When I originally set it up I was able to successfully use MDT 2010 to create my boot images as well as creating task sequences that would sysprep and capture, and deploy my custom .wim files. Everything was working perfectly. About a month later I boot up my Windows 7 x86 image and run Windows updates to keep my image up to date. I then go and run my sysprep and capture task sequence and I get the following errors: I searched online for the cause of this error message and it just seems to be a generic permission denied type of error message. I then decided to completely rebuild my VM image from scratch and try again. I am still getting the same error messages as before. The following is what I have tried troubleshooting this issue: Troubleshooting: I have ensured that that UAC and the firewall is turned completely off when trying to capture the image. I have tried recreating the task sequence and making sure that the deployment share is updated. I have ensured that the local Administrator account is enabled and has the same password as specified in the task sequence. I have tried joining the computer to the domain and running the task sequence and I get a different error: I have attempted to run the script from the command prompt with "Run as Administrator" and I still receive the same errors above. For testing purposes I have ensured that Everyone has read/write access to my deployment share. I have spent days on trying to resolve this to no avail. Any ideas? EDIT: Below is the log info from C:\Windows\Deploymentlogs\BDD.log as requested. <![LOG[LTI Windows PE applied successfully]LOG]!><time="11:48:34.000+000" date="07-25-2012" component="LTIApply" context="" type="1" thread="" file="LTIApply"> <![LOG[LTIApply processing completed successfully.]LOG]!><time="11:48:34.000+000" date="07-25-2012" component="LTIApply" context="" type="1" thread="" file="LTIApply"> <![LOG[Microsoft Deployment Toolkit version: 6.0.2223.0]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[The task sequencer log is located at C:\Users\nicy\AppData\Local\Temp\SMSTSLog\SMSTS.LOG. For task sequence failures, please consult this log.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[Processing drivers for an X86 operating system.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[TargetOS is the current SystemDrive]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[Property DriverCleanup is now = DONE]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[Compare Image processor Type with Original [X86] = [X86].]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[Prepare machine for Sysprep.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[No driver actions can be taken for OS Images installed from *.wim files.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[ZTIDrivers processing completed successfully.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="ZTIDrivers" context="" type="1" thread="" file="ZTIDrivers"> <![LOG[Command completed, return code = -2147467259]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> <![LOG[Litetouch deployment failed, Return Code = -2147467259 0x80004005]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="3" thread="" file="LiteTouch"> <![LOG[For more information, consult the task sequencer log ...\SMSTS.LOG.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> <![LOG[Property RetVal is now = -2147467259]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> <![LOG[Unable to copy log to the network as no SLShare value was specified.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> <![LOG[CleanStartItems Complete]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> <![LOG[Unregistering TSCore.dll.]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> <![LOG[About to run command: wscript.exe "\\server\deploymentshare$\Scripts\LTICleanup.wsf"]LOG]!><time="11:48:35.000+000" date="07-25-2012" component="LiteTouch" context="" type="1" thread="" file="LiteTouch"> <![LOG[Microsoft Deployment Toolkit version: 6.0.2223.0]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Removing AutoAdminLogon registry entries]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[VSSMaxSize not specified using 5% of volume.]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Logs contained 7 errors and 0 warnings.]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Stripping BDD commands from unattend.xml template.]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Modified unattend.xml saved to C:\windows\panther\unattend.xml]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Checking mapped network drive.]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[testing drive Z: mapped to \\server\deploymentshare$]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Disconnecting drive Z: mapped to \\server\deploymentshare$]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Cleaning up C:\MININT directory.]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup"> <![LOG[Cleaning up TOOLS, SCRIPTS, and PACKAGES directories.]LOG]!><time="11:48:36.000+000" date="07-25-2012" component="LTICleanup" context="" type="1" thread="" file="LTICleanup">

    Read the article

  • ASP.NET MVC & EF4 Entity Framework - Are there any performance concerns in using the entities vs retrieving only the fields i need?

    - by Ant
    Lets say we have 3 tables, Users, Products, Purchases. There is a view that needs to display the purchases made by a user. I could lookup the data required by doing: from p in DBSet<Purchases>.Include("User").Include("Product") select p; However, I am concern that this may have a performance impact because it will retrieve the full objects. Alternatively, I could select only the fields i need: from p in DBSet<Purchases>.Include("User").Include("Product") select new SimplePurchaseInfo() { UserName = p.User.name, Userid = p.User.Id, ProductName = p.Product.Name ... etc }; So my question is: Whats the best practice in doing this? == EDIT Thanks for all the replies. [QUESTION 1]: I want to know whether all views should work with flat ViewModels with very specific data for that view, or should the ViewModels contain the entity objects. Real example: User reviews Products var query = from dr in productRepository.FindAllReviews() where dr.User.UserId = 'userid' select dr; string sql = ((ObjectQuery)query).ToTraceString(); SELECT [Extent1].[ProductId] AS [ProductId], [Extent1].[Comment] AS [Comment], [Extent1].[CreatedTime] AS [CreatedTime], [Extent1].[Id] AS [Id], [Extent1].[Rating] AS [Rating], [Extent1].[UserId] AS [UserId], [Extent3].[CreatedTime] AS [CreatedTime1], [Extent3].[CreatorId] AS [CreatorId], [Extent3].[Description] AS [Description], [Extent3].[Id] AS [Id1], [Extent3].[Name] AS [Name], [Extent3].[Price] AS [Price], [Extent3].[Rating] AS [Rating1], [Extent3].[ShopId] AS [ShopId], [Extent3].[Thumbnail] AS [Thumbnail], [Extent3].[Creator_UserId] AS [Creator_UserId], [Extent4].[Comment] AS [Comment1], [Extent4].[DateCreated] AS [DateCreated], [Extent4].[DateLastActivity] AS [DateLastActivity], [Extent4].[DateLastLogin] AS [DateLastLogin], [Extent4].[DateLastPasswordChange] AS [DateLastPasswordChange], [Extent4].[Email] AS [Email], [Extent4].[Enabled] AS [Enabled], [Extent4].[PasswordHash] AS [PasswordHash], [Extent4].[PasswordSalt] AS [PasswordSalt], [Extent4].[ScreenName] AS [ScreenName], [Extent4].[Thumbnail] AS [Thumbnail1], [Extent4].[UserId] AS [UserId1], [Extent4].[UserName] AS [UserName] FROM [ProductReviews] AS [Extent1] INNER JOIN [Users] AS [Extent2] ON [Extent1].[UserId] = [Extent2].[UserId] LEFT OUTER JOIN [Products] AS [Extent3] ON [Extent1].[ProductId] = [Extent3].[Id] LEFT OUTER JOIN [Users] AS [Extent4] ON [Extent1].[UserId] = [Extent4].[UserId] WHERE N'615005822' = [Extent2].[UserId] or from d in productRepository.FindAllProducts() from dr in d.ProductReviews where dr.User.UserId == 'userid' orderby dr.CreatedTime select new ProductReviewInfo() { product = new SimpleProductInfo() { Id = d.Id, Name = d.Name, Thumbnail = d.Thumbnail, Rating = d.Rating }, Rating = dr.Rating, Comment = dr.Comment, UserId = dr.UserId, UserScreenName = dr.User.ScreenName, UserThumbnail = dr.User.Thumbnail, CreateTime = dr.CreatedTime }; SELECT [Extent1].[Id] AS [Id], [Extent1].[Name] AS [Name], [Extent1].[Thumbnail] AS [Thumbnail], [Extent1].[Rating] AS [Rating], [Extent2].[Rating] AS [Rating1], [Extent2].[Comment] AS [Comment], [Extent2].[UserId] AS [UserId], [Extent4].[ScreenName] AS [ScreenName], [Extent4].[Thumbnail] AS [Thumbnail1], [Extent2].[CreatedTime] AS [CreatedTime] FROM [Products] AS [Extent1] INNER JOIN [ProductReviews] AS [Extent2] ON [Extent1].[Id] = [Extent2].[ProductId] INNER JOIN [Users] AS [Extent3] ON [Extent2].[UserId] = [Extent3].[UserId] LEFT OUTER JOIN [Users] AS [Extent4] ON [Extent2].[UserId] = [Extent4].[UserId] WHERE N'userid' = [Extent3].[UserId] ORDER BY [Extent2].[CreatedTime] ASC [QUESTION 2]: Whats with the ugly outer joins?

    Read the article

  • Transaction on Entity FrameWork Refactoring and best performance how can i?

    - by programmerist
    i try to use transaction in Entity FrameWork. i have 3 tables Personel, Prim, Finans. in Prim table you look SatisTutari (int) if i add data in SatisTutari.Text instead of int value adding float value. Trannsaction must be run! Everything is ok but how can i refactoring or give best performance or best writing Transaction coding! i have 3 table so i have 3 entities: CREATE TABLE Personel (PersonelID integer PRIMARY KEY identity not null, Ad varchar(30), Soyad varchar(30), Meslek varchar(100), DogumTarihi datetime, DogumYeri nvarchar(100), PirimToplami float); Go create TABLE Prim (PrimID integer PRIMARY KEY identity not null, PersonelID integer Foreign KEY references Personel(PersonelID), SatisTutari int, Prim float, SatisTarihi Datetime); Go CREATE TABLE Finans (ID integer PRIMARY KEY identity not null, Tutar float); Personel, Prim,Finans my tables. if you look Prim table you can see Prim value float value if i write a textbox not float value my transaction must run. protected void btnSave_Click(object sender, EventArgs e) { using (TestEntities testCtx = new TestEntities()) { using (TransactionScope scope = new TransactionScope()) { Personel personel = new Personel(); Prim prim = new Prim(); Finans finans = new Finans(); //-----------------------------------------------------------------------Step 1 personel.Ad = txtName.Text; personel.Soyad = txtSurName.Text; personel.Meslek = txtMeslek.Text; personel.DogumTarihi = DateTime.Parse(txtSatisTarihi.Text); personel.DogumYeri = txtDogumYeri.Text; personel.PirimToplami = float.Parse(txtPrimToplami.Text); testCtx.AddToPersonel(personel); testCtx.SaveChanges(); //----------------------------------------------------------------------- step 2 prim.PersonelID = personel.PersonelID; prim.SatisTutari = int.Parse(txtSatisTutari.Text); prim.SatisTarihi = DateTime.Parse(txtSatisTarihi.Text); prim.Prim1 = double.Parse(txtPrim.Text); finans.Tutar = prim.SatisTutari * prim.Prim1; testCtx.AddToPrim(prim); testCtx.SaveChanges(); //----------------------------------------------------------------------- step 3 lblTutar.Text = finans.Tutar.Value.ToString(); testCtx.AddToFinans(finans); testCtx.SaveChanges(); scope.Complete(); } } How can i rearrange codes. i need best practice refactoring and best solution for reading easly and performance!!!

    Read the article

  • MVC Entity Framework: Cannot open user default database. Login failed.

    - by Michael
    This type of stuff drives me nuts. I'm having trouble finding the exact issue that I'm having, maybe I just don't know the terminology. Anyway, I had a working website using MVC and Entity Framework, but then I coded an error in a partial view page (ascx). Then all of a sudden I started to get this message. Cannot open user default database. Login failed. Login failed for user 'NT AUTHORITY\SYSTEM' I've found plenty of suggestions about opening SQL Server Management Studio, Double Click on Security, Double Click on Logins, Double click on NT AUTHORITY\SYSTEM and then double click on User Mapping. In this view I'm suppose to check the box for my database so that this user is mapped to this login. However, since I created my database in Visio Studio 2008 as part of my solution, it doesn't show up to allow me to click on it. So what do I do now? What drives me nuts is that everything was working fine. I was using my computer name to access the website and everything was working fine until the coding error. I've fix the error but still getting the error. I should also mention that this error started yesterday too around the same time but later cleared itself up. If I use localhost to access the site, it works just fine. IIS7 configuration for my website: Application Pool = DefaultAppPool Physical Path Credentials Logon = ClearText With in connection strings. I do see the one for my database in this solution. Entry Type is local metadata=res://*/Models.DataModel.csdl|res://*/Models.DataModel.ssdl|res://*/Models.DataModel.msl; provider=System.Data.SqlClient; provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\FFBall.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True" And somewhere I remember changing the identity from Network Service to LocalSystem. Because when I first stared I was getting this same message, but I changed this value and it started working. I saw that suggested somewhere too but I do not recall. Wait I remember now, I believe in IIS7, under Application Pools, DefaultAppPool identity is set to LocalSystem. Additional things I've tried. Restart the computer Recycle the application pool. Antivirus isn't running. Any help would be appreciated. Thank you in advance.

    Read the article

  • Unknown Entity namespace alias in symfony2

    - by Zoha Ali Khan
    Hey I have two bundles in my symfony2 project. one is Bundle and the other one is PatentBundle. My app/config/route.yml file is MunichInnovationGroupPatentBundle: resource: "@MunichInnovationGroupPatentBundle/Controller/" type: annotation prefix: / defaults: { _controller: "MunichInnovationGroupPatentBundle:Default:index" } MunichInnovationGroupBundle: resource: "@MunichInnovationGroupBundle/Controller/" type: annotation prefix: /v1 defaults: { _controller: "MunichInnovationGroupBundle:Patent:index" } login_check: pattern: /login_check logout: pattern: /logout inside my controller i have <?php namespace MunichInnovationGroup\PatentBundle\Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use JMS\SecurityExtraPatentBundle\Annotation\Secure; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\Security\Core\SecurityContext; use MunichInnovationGroup\PatentBundle\Entity\Log; use MunichInnovationGroup\PatentBundle\Entity\UserPatent; use MunichInnovationGroup\PatentBundle\Entity\PmPortfolios; use MunichInnovationGroup\PatentBundle\Entity\UmUsers; use MunichInnovationGroup\PatentBundle\Entity\PmPatentgroups; use MunichInnovationGroup\PatentBundle\Form\PortfolioType; use MunichInnovationGroup\PatentBundle\Util\SecurityHelper; use Exception; /** * Portfolio controller. * @Route("/portfolio") */ class PortfolioController extends Controller { /** * Index action. * * @Route("/", name="v2_pm_portfolio") * @Template("MunichInnovationGroupPatentBundle:Portfolio:index.html.twig") */ public function indexAction(Request $request) { $portfolios = $this->getDoctrine() ->getRepository('MunichInnovationGroupPatentBundle:PmPortfolios') ->findBy(array('user' => '$user_id')); // rest of the method } when i try to load localhost/web/app_dev.php/portfolio It says Unknown Entity namespace alias 'MunichInnovationGroupPatentBundle'. I am unable to figure out this error please help me if anyone has any idea I googled it a lot :( Thanks in advance 500 Internal Server Error - ORMException

    Read the article

  • DDD and MVC: Difference between 'Model' and 'Entity'

    - by Nathan Loding
    I'm seriously confused about the concept of the 'Model' in MVC. Most frameworks that exist today put the Model between the Controller and the database, and the Model almost acts like a database abstraction layer. The concept of 'Fat Model Skinny Controller' is lost as the Controller starts doing more and more logic. In DDD, there is also the concept of a Domain Entity, which has a unique identity to it. As I understand it, a user is a good example of an Entity (unique userid, for instance). The Entity has a life-cycle -- it's values can change throughout the course of the action -- and then it's saved or discarded. The Entity I describe above is what I thought Model was supposed to be in MVC? How off-base am I? To clutter things more, you throw in other patterns, such as the Repository pattern (maybe putting a Service in there). It's pretty clear how the Repository would interact with an Entity -- how does it with a Model? Controllers can have multiple Models, which makes it seem like a Model is less a "database table" than it is a unique Entity. So, in very rough terms, which is better? No "Model" really ... class MyController { public function index() { $repo = new PostRepository(); $posts = $repo->findAllByDateRange('within 30 days'); foreach($posts as $post) { echo $post->Author; } } } Or this, which has a Model as the DAO? class MyController { public function index() { $model = new PostModel(); // maybe this returns a PostRepository? $posts = $model->findAllByDateRange('within 30 days'); while($posts->getNext()) { echo $posts->Post->Author; } } } Both those examples didn't even do what I was describing above. I'm clearly lost. Any input?

    Read the article

  • How to make an entity out of a join table without primary key

    - by tputkonen
    I'm trying to generate JPA entities out of an existing database having an "interesting" design. Database has a table called UserSet, which can have links to several other UserSets. There is a one to many relation between UserSets and LinkedUserSets. LinkedUserSets also has one to one relation to UserSets. I tried to generate a JPA Entity out of the database structure using Dali JPA Tools. The resulting entity Linkeduserset misses @Id or @EmbeddedId annotation and thus failes to compile. As the resulting entity contains only two @JoinColumns (which cannot be marked as @Id), I have not so far found a way around this issue. Database structure can not be modified in any way. Is there a way to overcome this somehow? Relevant pars of create table statements: CREATE TABLE `LinkedUserSets` ( `UsrSetID` INT(11) NOT NULL DEFAULT '0' , `ChildID` INT(11) NOT NULL DEFAULT '0' , CONSTRAINT `fk_LinkedUserSets_UserSet1` FOREIGN KEY (`UsrSetID` ) REFERENCES `UserSet` (`UsrSetID` )); CREATE TABLE `UserSet` ( `UsrSetID` INT(11) NOT NULL AUTO_INCREMENT , PRIMARY KEY (`UsrSetID`), CONSTRAINT `fk_UserSet_LinkedUserSets1` FOREIGN KEY (`UsrSetID` ) REFERENCES `LinkedUserSets` (`ChildID` )); Generated entities: @Entity @Table(name="linkedusersets") public class Linkeduserset { //bi-directional many-to-one association to Userset @ManyToOne @JoinColumn(name="UsrSetID") private Userset userset1; //bi-directional one-to-one association to Userset @OneToOne @JoinColumn(name="ChildID") private Userset userset2; } @Entity @Table(name="userset") public class Userset { private static final long serialVersionUID = 1L; @Id @Column(name="UsrSetID") private int jngSetID; //bi-directional many-to-one association to Linkeduserset @OneToMany(mappedBy="userset1") private Set<Linkeduserset> linkedusersets; //bi-directional one-to-one association to Linkeduserset @OneToOne(mappedBy="userset2") private Linkeduserset linkeduserset; } Error message: Entity "Linkeduserset" has no Id or EmbeddedId

    Read the article

  • How to deal with unknown entity references?

    - by Chris
    I'm parsing (a lot of) XML files that contain entity references which i dont know in advance (can't change that fact). For example: xml = "<tag>I'm content with &funny; &entity; &references;.</tag>" when i try to parse this using the following code: final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilder db = dbf.newDocumentBuilder(); final InputSource is = new InputSource(new StringReader(xml)); final Document d = db.parse(is); i get the following exception: org.xml.sax.SAXParseException: The entity "funny" was referenced, but not declared. but, what i do want to achieve is, that the parser replaces every entity that is not declared (unknown to the parser) with an empty String ''. Or even better, is there a way to pass a map to the parser like: Map<String,String> entityMapping = ... entityMapping.put("funny","very"); entityMapping.put("entity","important"); entityMapping.put("references","stuff"); so that i could do the following: final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilder db = dbf.newDocumentBuilder(); final InputSource is = new InputSource(new StringReader(xml)); db.setEntityResolver(entityMapping); final Document d = db.parse(is); if i would obtain the text from the document using this example code i should receive: I'm content with very important stuff. Any suggestions? Of course, i already would be happy to just replace the unknown entity's with empty strings. Thanks,

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >