Architecture :: XML Response Text As Entity Data Provider?
Nov 23, 2010
I'm writing an application that needs to map two different stores into different properties of the same entity. Basically, we have a CMS that exposes a file list PDF's via a web service. We have to send it an XML request and the response contains the data that needs to be parsed into each entity.
'm not sure how to modify the model in this way though. I can think of two ways to handle this,1. Create a new Schema that uses something like the System.Xml.Provider for each different request type/result set2. Write a partial class for the Entity and populate all the unmapped fields using serialized XML I'm actually unsure how to actually do either of the above, but if someone knows a good starting point or a better way to go about this please let me know. This is my first MVC project and so I'm not completely up to speed on all the concepts/best pracise.
recently i've studied on ADO.NET's Entity Model Framework and say 'wow' as ORM is one of the fevourite pattern i practice..but suddenly i've come to an ambiguous situation when i'm going to start. i usually follow the following 3-tier architecture..
1. UI Layer 2. BLL - business logic layer 3. DAL - Data Access Layer a. DTO / DAO b. Gateway (contains the sql query/stored procedure and connection with DB)
now when i'm going to use the Entity Model Design,where the DBML/ .edmx File should be placed? Because many a times i'm using the DBML file as DTO because of the mapped objects.. in the same time, sometimes DBML ( .edmx file in .NET 4.0) contains CRUD methods and stored procedured method as well as methods with different selection operations,- which should be in Gateway. so where the .edmx file should be placed !?!! IN DTO namespace !? or in Gateway namespace!
moreover sometimes there is no need for the BLL which breaks the rules of inter-layer-communication (UI > BLL > DAL.Gateway)! what makes me confuse is, what should be the ideal n-tier architecture when i'll use the ADO.NET Entity Model Design Framework
I get this error when I try to publish a asp.net 4.0 application on my server. I am using entity framework and mysql as the database. Unable to find the requested .Net Framework Data Provider. It may not be installed.
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.] System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +251 [ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.] System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +10983191 System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +641 System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +67 Satelite.Dados.sateliteEntities..ctor() in E:Sites_dotNet4.0satelite runkSistemaDadosSatelite.Designer.cs:64 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247 System.Activator.CreateInstance(Type type, Boolean nonPublic) +106 System.Web.DynamicData.<>c__DisplayClass2.<RegisterContext>b__1() +15 System.Web.DynamicData.MetaModel.RegisterContext(Func`1 contextFactory, ContextConfiguration configuration) +483 Satelite.Global.RegisterRoutes(RouteCollection routes) in E:Sites_dotNet4.0satelite runkSistemaSateliteGlobal.asax.cs:35 [HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3988565 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375 [HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373
I'm trying to use the Entity Framework with a Firebird database in Visual Studio 2010
Useful info:
Windows 7 64-bit Visual Studio 2010 Ultimate Firebird 2.5.0 Firebird .Net Data Provider 2.6 DDEX 2.0.5
I've done:
Installed Firebird server (and it works and I can connect to a database) Downloaded DDEX (I've run the registry files) used the gacutil on the FirebirdSql.Data.FirebirdClient.dll and checked that it indeed was installed and it was Modyfied the machine.config for both 2.0 and 4.0 in 32-bit and 64 bit folders to include the provider in the element When I try to add a connection in the server explorer I choose "Firebird Data Source" and the Firebird data provider and press continue. I the "Add Connection" dialog window I fill in the info "data source, database, user, password.." and press ok and then I get the following error:
Failed to find or load the registered .Net Framework Data Provider Also when I try to add a new Entity Data Model I cannot see the Firebird option.. I can only see SQL options. I really need help on this one as I've spent many hours on this and I cannot get it to work.. I've also read other related questions on SO,
We're upgrading our system core asp to asp.net mvc, but there is a problem with refreshing the Database Model, our system is a UDP listener Windows Service, and Instering data to our database, our web system reading the database and process it then render. Here is the problem, When i enter some data using DatabaseModel, there is no problem, but when Windows service insert records to database, i can see the record at the web, is there a way to refresh entity data model/
I am using the ADO.NET Entity Framework for loading data from the database. The classes are directly mapped to database tables in the database. The problem is that these classes are not optimal for binding to the UI elements. As a result of this I have some custom entities which are populated at the service layer and returned. It is these custom entities (classes) to which I bind the UI elements. My questions on this are1. Is populating these entities at the service layer the most appropriate way to do this. I personally do not think so because if we introduce some additional UI elements which need different entities then I have to modify the service layer again.2. What is the best approach/pattern to get this done.
I just tring to a complex (for me) with ado.net entity framework this is the structure: In practice it is a sort of group purchasing (Buyers) For each group of purchase (Buyer) should have the opportunity 'to select all products of the brands indicated in buyer I'm doing function to return correct data like this:
public List<Product> GetProductsByBuyer(int vBuyerId) { Buyersctx.Products.MergeOption = MergeOption.NoTracking; return (from lProduct in Buyersctx.Products.Include("Brand").Include("Buyers") where select lProduct).ToList(); }
We have been really tired lately dealing with all bugs that comes out of ODP.Net and the lag time to bring out any new product out. I am looking for ado.net provider for oracle and looking for the following:
1. Entity Framework
2. Linq
3. Good support (in case we run into issues)
4. Quick response to open issues
5. Quick updates and new releases
I looked at datadirect and dotConnect by DevArt...But I am not sure if any one is better than other.
I am trying to understand the fundamental differences between the Provider Model and Repository Pattern.
I have used the Provider Model in many many situations and am confident with it when designing applications. However, the more examples I encounter on the internet and asp.net evolution I keep coming across "Repository" Interfaces for classes that look like a Provider Model.
I have dug around a bit but all I can see is that they kinda do the same thing, or closely overlap by enforcing an inheriting class to adhere to a "contract" of implemented / abstracted methods etc...is there more to it?
assume I have a multi layer application with the following logical separation between layer:
Presentation Layer Service Layer business Layer Data access layer
I'd like to use a custom asp.net membership provider for authentication/authorization in my app. which is the best layer where to put the custom asp.net membership provider?
I am redesigning a Solution's Architecture to implement SOA.
After doing the design changes I have come up with:
MySolution.Client.MyProject.Web ...... //ASP.NET WebSite MySolution.Client.MyProject.Proxy .... //Service Proxy C# Library Project *[1] MySolution.Service ................... //Service.cs for Service.svc is here MySolution.Service.DataContract ...... //IService.cs for Service.cs is here *[2] [code]....
This project contains IService and Request/Response Classes
All methods in Service.cs takes the Request classes as input and return Response classes as output
Therefore this project is referenced by the 2 Client Projects(Web and Proxy), as it contains the IService and all of the Request/Response classes that will be required to communicate with Service.cs
*[3]MySolution.Model: This project contains the .edmx that is the Data Model of Entity Framework and some custom classes that are used in the project.
PROBLEM: Because I only use Request/Response classes to communicate between service and client, The MySolution.Service.DataContract project is only used by Service.cs and Repository.cs
And due to that all responses that Repository generates i have to map them to the properties of its respective response class (which make both the original returned entity, and the response class almost identical). But i am OKAY with it ...
e.g: GetCustomer() in Repository.cs method is called by Service.cs
GetCustomer() method in repository performs the LINQ query and return a "Customer" object
Service.cs then maps all the properties of "Customer" object to the "CustomerResponse" object
Service.cs then returns the "CustomerResponse" to the caller.
in this case most of the properties will repeat in both classes, if there is solution to this, its good, otherwise, I am fine with it.However, when Repository.cs's method GetCustomers() (Notice its not GetCustomer()) is called, it will return List of Customer object, and mapping this for return purpose would mean a "for loop" that iterates the collection and do the mapping ... this is NOT OKAY ...
is there any better way of doing this, considering I do not want to return "Customer" object without "CustomerResponse" as first of all it violates the SOA architecture, and secondly I don't want my Client Projects to have any reference to the Model or Repository projects.
I am new to Entity frameworks-EF. As, EF is built on top of ADO.NET...If so, will there be any performance issue when we use it?Same way MVC also targets Test Driven , rapid application development only ..What speciality does it add for end-users?As per my understanding ASP.Net 2.0 itself is powerful without MVC and/or EF...
I am thinking to use entity model as DAL, how should I create the BLL then? What kind of datasourceobject should I use in the asp pages?
I am looking for best practice to use Entity framework 2 in the three layers design. I had experience at dataset with three layers design.
Should I use objectdatasource at the pages for gridviews? My guess is that entitydatasource by passed the BLL which is not good, so the only option left is the objectdatasource.
Could and should my BL object inherit those entity model in the DAL, so I dont need to recreate their object's property?
Our solutions requires validating users against a custom database. This also includes roles which dictates what he user can do in the system. What is the best way to implement implement security, is it to use Windows Identity Foundation or the default Membership Provider and Role Provider that comes with .net?
I have a requirement below;Step 1: I must insert and update record with "xx" Running Number into Tables in Database.Step 2: I must send "xx" Running Number from Step 1 go with Web Service and wait the response.Step 3: If Step 2 has a error. I must roll back Step 1 data that I do in Step 1. But If Step 2 is success, everything is Ok.How can I solve this requirement? and How can I write asp.net code?
At work I need to create a new web application, that will connect to an MySql Database.
(So far I only have expercience with Linq-To-Sql classes and MSSQL servers.)
My superior tells me to use the entity framework (he probably refers to Linq-To-Entity) and provide everything as a service based architecture. Unfortunately nobody at work has experience with that framework nor with a real nice server oriented architecture. This speficic project I'm leading will be long-term, meaning multiple years, so it would be best to design it the way, that multiple target plattforms like asp.net, c# wpf, ... could use it)For now, the main target plattform is ASP.net
So I do have the following questions:
1) Where can I read best what's really behind service oriented architecture (but for now beginner tutorials work fine as well) and how to use it in best practise?
2) So far I can't see a real difference between Linq-To-Sql classes and the information I've googled so far on the 'entity framework'. So, whats the difference? Where do I find nice tutorials for it?
3) Is there any difference in the entity framework regarding the database server (MSSQL or MySQL)? If not, does that mean that code snipperts I will stumble across will word database independent?
I'm using .net 3.5 and am currently creating a web application used to generate a report through Aspose.CellsActually, the page is composed in a form where I get the configuration of the report I have to generate. The "generation" button is in an update panel. When I click on it, the "generation" button is hidden and a progress bar appears. When the excel file is generated, I save it in a memory stream and I send it back to the aspx page where I change the headers to allow the file's download.
if there is any config setting or any other way to force the response to be written all at once instead of it being written in multiple packets??The problem is I am using a response filter to edit anchor href's and the html parser (HtmlAgilityPack) strips out the malformed HTML when the framework writes to the response stream multiple times, so enforcing an all at once write would solve this headache.
I can't to understand clearly how to create strong and quickly application using EF. For example, I have class ForumPost (table ForumPost) for select one of record I write method like:
public ForumPost ForumPost(int ForumPostID) { return (from i in _dataContext.ForumPostSet where i.ForumPostID == ForumPostID select i).First(); }
all works. But on page (I use ASP.NET MVC) I should display info from another linked tables, ForumName (each post have ForumID) etc. So, I modify this method to:
public ForumPost ForumPost(int ForumPostID) { return (from i in _dataContext.ForumPostSet .Include("ChildPosts").Include("ParentPost").Include("Users").Include("Forums").Include("Tags").Include("ForumPostPolls") where i.ForumPostID == ForumPostID select i).First(); }
ok, all works. Then I want to make some actions in model with ForumPost, i.e.
public void RootPost(int PostID, ref Models.ForumPost Root) { ForumPost post = ForumPost(PostID); if (post.RootPost != null) { Root = ForumPost(post.RootPost.ForumPostID); } else Root = post; }
it works too. But problem is in speed. I not need in RootPost all those includes. So, I should to create one more method like:
private ForumPost ForumPostIncludes1(int ForumPostID) { return (from i in _dataContext.ForumPostSet .Include("ChildPosts") where i.ForumPostID == ForumPostID select i).First(); }
then ForumPostIncludes2, ForumPostIncludes3 etc... second way - redesign RootPost with LINQ expr, not with call another method. But in this way difficulties to change DB. third way? How to do it correctly?