SQL71561: View contains unresolved reference to Is_Distributed - visual-studio-2017

I have created a brand new database project in VS 2017. I have set the target platform to SQL Server 2016 and have added master and msdb as references.
The issue I am having is that I have a view that references sys.availability_groups and filters on the column is_distributed. It is throwing this error:
SQL71561: View: [dbo].[VUHL_vw_AGInfo] contains an unresolved
reference to an object. Either the object does not exist or the
reference is ambiguous because it could refer to any of the following
objects: [master].[sys].[availability_groups].[AG]::[is_distributed],
[master].[sys].[availability_groups].[is_distributed],
[master].[sys].[availability_replicas].[AG]::[is_distributed],
[master].[sys].[dm_hadr_availability_group_states].[AG]::[is_distributed],
[master].[sys].[dm_hadr_availability_replica_states].[AG]::[is_distributed]
or
[master].[sys].[dm_hadr_database_replica_states].[AG]::[is_distributed].
I know the column exists, and I know that it didn't used to exist prior to 2016 and I asked this question. However, even with that workaround it won't recognize the column.
Is there a way to get the database project to recognize the column, or to tell it not to care?

I'm not 100% certain what I've done to get this working now, but it's now working.
Essentially, I closed and reopened VS and saw that somehow master and msdb were added twice as references. I removed all of those references, saved, and closed VS. I then reopened the project, added the references, and now it's working.

Related

MDS business rule on more then one domain based attribute

I'm stuck with this problem on Master Data Service (MDS).
I have an entity that has two domain based to other two entities.
I created the first business rule with the first domain based and it works perfectly.
But when I try to create a second business rule with the second domain based, an error appears:
200095 : Cannot specify more than one entity in MetadataGet
400003 : The attribute reference is not valid. The attribute was not found.
400003 : The attribute reference is not valid. The attribute was not found.
Obviously the attribute is valid. In fact, if I delete the first business rules, the second one is published correctly.
I think that MDS block a second business rules if you try to apply to a second domain based attribute.
This happened to us as well, and it seems that this error only occurs if a specific set of actions is taken:
We first restored the MDS 2012 database on SQL Server 2017
We upgraded a database using MDS management tool. Mind that the multi-entity business rules work fine now - they return no errors upon saving, can be published and successfully evalueted
We then realized that we are missing some code changes, so we decided to create a full model package using MDSModelDeploy.exe in our old MDS 2012
We deployed that package using MDSModelDeploy deployupdate command. After that the existing multi-entity rules are failing to publish, you are also unable to create new rules based on different entities within one entity. Unfortunately, we have found no fix for it, as there are simpler ways around it.
At this point we took a step back, restored and upgraded the old database once again, and it turned out that the rules worked, so it got to be the package that has broken those. I do not know what your situation was, since when we created a fresh model in SQL 2017 all of the multi-entity based rules worked perfectly, so I am curious to know what steps should be taken to reproduce the error in your case.
The only possible approach I can think of to fix the situation in point 4, would be to create an MDSModelDeploy update package from the corrupted model and another one from a new, healthy model, and then compare how the XMLs of the multi-entity business rules are structured. We did not try this one though, since we found the workaround described previously.

Doctrine: how to set referenceOne relationship without finding() the referenced document?

we need to create a document which references one document in another collection. We know the id of the document being referenced and that's all we need to know.
our first approach is:
$referencedDocument=$repository->find($referencedId);
$newDocument->setUser($referencedDocument);
now the question is if we can do it somehow without the first line (and hitting the database). In the db (we use Mongo) reference is just an integer field and we know that target id, so finding() the $referencedDocument seems redundant.
We tried to create new User with just an id set, but that gets us an error during persisting.
Thanks!
In one of projects I used something like this:
$categoryReference = $this->getEntityManager()->getReference(ProjectCategory::class, $category['id']);
Thou, if you use Mongo, you probably need to use getDocumentManager()
So, link to doctrine docs. mongo odm 1.0.

Detect whether new Ember Data records have been changed by the user

When a new record is created using Ember Data, then get("isDirty") returns true. But as yet, the user has made no changes to the record, and we can discard it without losing any of the user's work.
Is there any official, supported way to detect this situation, where a record has been created but no properties have been set?
(There's in incomplete answer to this question for a much older version of Ember Data, before it was substantially overhauled. The didSetProperty function still exists in current releases, but it's undocumented. Still, it might be a possible path to a solution if nothing official can be found.)
Internally, the changed properties are tracked by the _attributes property. You could do a check of
record.get('isNew') && Ember.keys(record._attributes).length === 0
to see that it has just been created and nothing has been changed on it.
Note that this is not meant to be part of the external API, but I'm not aware of any external API to accomplish this.

Update a TDBGrid in C++ Builder

Embarcadero's documentation on a lot of the DB components is incomplete and asks that users update it. As a result I can't figure out how to get my DBGrid to update with a new SQL statement.
I have it call my SQL Statement just fine to begin with, however when I change the SQL statement and call the same update statement it still displays the original Grid.
I am using a TDataSource object to connect to my TADOQuery in order to fill my DBTable. When I update my TADOQuery and have it rerun the query, then call the Update Function on my DBGrid, I see no difference. Is there something extra I need to be doing with the TDataSource?
Edit: I copied the TDataSource, deleted the original, closed and opened Builder and it worked fine.
copied the TDataSource, deleted the original, closed and opened Builder and it worked fine.

ATL simple object wizard - "Object Xxx already exists" error

I am attempting to create a new COM object in my DLL using the ATL Simple Object Wizard in Visual Studio 2005.
I enter the short name for the object, and all of the other fields are derived.
However, when I click Next in the wizard, the following error message comes up:
Object 'IXxxInterfaceName' already exists
I have searched my entire solution for all references to IXxxInterfaceName and can't see it defined anywhere.
How is the wizard determining that it exists already?
I never found out why the wizard determined that the object name existed already - I'm guessing something was cached somewhere that I couldn't track down.
In the end, I appended a 2 to the end of the interface name when creating it which allowed it to be added. Then I replaced all the occurrences of IXxxInterfaceName2 with IXxxInterfaceName. Everything worked after this.
If I ever track down the root cause of this problem, I'll update the answer.
Is it defined in a library you are referencing?
Also happens in VS 2008. However Clean solution and Clean project from build option solves this :-)