kindly note that I am developing an academic project based on Sedna database 3.5, I have a database which should contains of 4 XML files each one have its own schema file,
First question: how can I load those XSD files?? I had tried to load a collection which contains XML and XSD files, but I figured the collection is for one schema for all files, and I have a different schema for each file, Now, I am trying to load my xml documents from my .net application (not from cmd.exe) while I use Sedna .net API, I use Sedna upload function like:
Cursor.Current = Cursors.WaitCursor;
session.LoadDocument("doc1.xml","doc1.xml");
BUT what can I do for their xsd files???
The second Question: after I load xsd files correctly I have a query that insert a new node on some file, but I consider primary/unique key in my schema, but if I am right Sedna doesn't care about uniqueness, So I have to create a trigger before insert to check if the inserted value already exist, haven't I? if so, how can I implement this trigger and when to call it (if I build it in my .net application, it will be created each time I run the application??)
please advice
Related
We have a SQL 2019 database where all table names are fully qualified in views starting with the database name. We do NOT have the option of avoiding the fully qualified reference as the view definition is auto-generated (otherwise I would simply not fully qualify them). When views are defined by referencing tables within the same database as the view, the SSDT project complains that it has an unresolved reference.
Visual Studio does not allow adding a database reference to itself. The only way I can get it to compile is to create a DACPAC of the same database and then add that as a reference along with removing the database variable ($Name).
Is there any other method of providing fully qualified table names in views without having to create a DACPAC in SSDT project?
Only way I'm aware of would be to take the view code out of the project and handle in post-deploy scripts. This is done by design, because the database name may not be what was defined in the original code.
You can't use 3-4 part naming in SSDT normally. You can workaround this by using variables in the code. So let's say, that you have [localhost].[reports].[dbo].[your_table] you'll need to use [$(ReportServer)].[$(ReportDatabase)].[dbo].[your_table].
I have a DacPac project containing objects which use three part naming to refer to the containing database (hundreds of instances such as [thisDb].[dbo].[obj]* exist). I need compare and update this database, but the db project fails to build due to 200+ sql71561 errors.
I did not want to remove the unnecessary database name part or switch to using a database name variable. To successfully build (or compare, and then update) a database using three part naming or fully qualified naming to refer to itself, there is a way I found to pacify visual studio. It's not what I'd prefer, but it works.
Create a copy of the original db project.
In the copy db project, update all local database object references to use just two part names ([dbo].[obj]) instead of three part names (I used find & replace).
Make sure the copy db project targets the same SQL server version and builds successfully.
Reference the copy db project from the original db project (whether via database variable, database name only, or dacpac).
The original db project can now build because its references can be resolved. You'll end up with a dacpac for both the original and the copy, but at least the errors are gone and it compiles.
We have an existing Db with about 100 odd tables - These were created the old way - use sql queries to generate the Db and use the SQL reader/writer to access and update the DB's.( ADO.net). A developer prior to me added few new tables to this using the EntityFramework (EDMX) approach. They just named the tables generated newly "DBEntities" and used this as a data source for the new pages that were then written in ASP. net webforms(apsx).
I am now tasked with developing some of the newer pages on this existing webforms app to be built in Angular 2.0. I started off with consolidating the one DB that this app reads ( which were referencing both the EDMX file and ado.net - having two config file entries - add name ="DbConn" connection string "".. and add name="DBEntities" the edmx conn string".) I removed the edmx files , used the reverse poco generator and created first class POCO's and generated my tt file. Updated my web config to include only one connection string "DBConn". Tested the app - all the old web form pages were working well. Only those aspx pages(controls that use DataBind..) that were referencing the EDMX files gave me this error - The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
I have tried everything(regenrated POCO's.. checked all the table names against the aspx data sources everything looks good..) and nothing seems to work. Using EF6. - Any help is appreciated..
Thanks much.
I've been trying to store my strings in a database using resource files to fetch them. I've been following the guide from http://afana.me/post/aspnet-mvc-internationalization-store-strings-in-database-or-xml.aspx
The example works fine enough when i use his sql code based on ADO.net to fetch the strings from the database.
But i want to use Entity Framework to fetch the strings from the database, because my translation table is quite different. Could anyone show me an example of how to use Entity Framework in the resource project(assembly?), because i can't seem to get it to work. I cant import any of my models or contexts from my main project with "using", and it tells me i have duplicate models when i copy them to the resources project/assembly
Currently in my Asp.Net website I store localization texts in a table in the database. The table has three columns:
TextCode nvarchar(100),
CultureId int,
TextString nvarchar(MAX)
So every time when I need to get a localized text for a specific culture I just do a simple query.
The main advantage of this method is simple and also I can update the texts while my web app is running.
The obvious drawback is performance. I use resource files for localization in other desktop applications. The reason I chose database is I am under an impression that updating the resource file in asp.net will cause the web app to reload and thus I need to take the site offline when I update the resource file. Is assumption true? What's the "common" approach to store localized texts in Asp.Net?
Thanks
Common approach is to use Global and Local resource files. If you want to use database consider using asp.net cache with sql cache dependency. In application start, load all your resource data from sql server and store it in cache, and create a utility class to return data from cache based on resource key.
I am using resource file to read the resources from.I am using LINQ to read the resources i.e. First of all I am loading the resource xml file in the XDocument and then querying the xml through LINQ to get the resource value.The problem is that everytime I need to read the resource value I have to load the resource file again and again i.e. the following line of code gets executed everytime:
XDocument resourceXML = XDocument.Load("path to resource file");
This in turn has an impact on the performance of application.
What I need is that I want the resource XML to be stored in CACHE and every time I need to read the XML to get the resource value I can read it from cache itself instead of time and again loading the .resx file.This I know will definately improve the performance of my application.
Any help will be greatly appreciated.
I am using resource file to read the resources from.I am using LINQ to
read the resources i.e. First of all I am loading the resource xml
file in the XDocument and then querying the xml through LINQ to get
the resource value
And you are doing in order to read a value stored in a resource file this instead of simply using the autogenerated strongly typed class: ResourceName.SomeResourceKey?
And if your answer is yes I have my reasons, then you may take a look at the System.Runtime.Caching namespace which contains all you need in order to cache data in a .NET application. For example there's the MemoryCache class. The System.Runtime.Caching assembly has been added in .NET 4.0 so if you are using older versions of the framework you could use the ASP.NET Cache.